On Friday, October 15, 2010, Enlightenment SVN
<[email protected]> wrote:
> Log:
> Update emote to build w/ current elm.
> Move main toolbar to the top.
> Use a 'toolbar' for channels at the bottom.
> Change init functions to use Eina_Bool.
> Disable lots of debug output in the emote irc protocol.
> Fix some formatting.
Dh, we added standard layout to default.edc, please use them whenever
possible or add more if you foresee a common use case. See ephoto. It
will make your life easier and your app more theme friendly
>
> NB: Still an issue here where the scrolled entry used for text is not
> resizing properly .. but I'm too tired to dig any further right now.
>
>
> Author: devilhorns
> Date: 2010-10-15 08:57:19 -0700 (Fri, 15 Oct 2010)
> New Revision: 53454
>
> Modified:
> trunk/PROTO/emote/src/bin/em_config.c trunk/PROTO/emote/src/bin/em_config.h
> trunk/PROTO/emote/src/bin/em_gui.c trunk/PROTO/emote/src/bin/em_gui.h
> trunk/PROTO/emote/src/bin/main.c trunk/PROTO/emote/src/lib/Emote.h
> trunk/PROTO/emote/src/lib/emote_event.c
> trunk/PROTO/emote/src/lib/emote_main.c
> trunk/PROTO/emote/src/lib/protocols/irc/irc_parse.c
>
> Modified: trunk/PROTO/emote/src/bin/em_config.c
> ===================================================================
> --- trunk/PROTO/emote/src/bin/em_config.c 2010-10-15 14:10:56 UTC (rev
> 53453)
> +++ trunk/PROTO/emote/src/bin/em_config.c 2010-10-15 15:57:19 UTC (rev
> 53454)
> @@ -15,7 +15,7 @@
> /* global variables */
> EM_INTERN Em_Config *em_config = NULL;
>
> -EM_INTERN int
> +EM_INTERN Eina_Bool
> em_config_init(void)
> {
> _em_config_edd = EM_CONFIG_DD_NEW("Em_Config", Em_Config);
> @@ -27,15 +27,15 @@
>
> em_config_load();
> em_config_save();
> - return 1;
> + return EINA_TRUE;
> }
>
> -EM_INTERN int
> +EM_INTERN Eina_Bool
> em_config_shutdown(void)
> {
> _em_config_cb_free();
> EM_CONFIG_DD_FREE(_em_config_edd);
> - return 1;
> + return EINA_TRUE;
> }
>
> EM_INTERN Em_Config_DD *
> @@ -184,18 +184,15 @@
> tb = elm_toolbar_add(_em_config_win);
> elm_toolbar_icon_size_set(tb, 16);
> elm_toolbar_align_set(tb, 0.0);
> - elm_toolbar_scrollable_set(tb, EINA_TRUE);
> +// elm_toolbar_scrollable_set(tb, EINA_TRUE);
> evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
> evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.5);
> elm_box_pack_end(bx, tb);
> evas_object_show(tb);
>
> - o = em_util_icon_add(_em_config_win, "preferences-system");
> - elm_toolbar_item_add(tb, o, _("General"), NULL, NULL);
> + elm_toolbar_item_add(tb, "preferences-system", _("General"), NULL, NULL);
> + elm_toolbar_item_add(tb, "go-home", _("Servers"), NULL, NULL);
>
> - o = em_util_icon_add(_em_config_win, "go-home");
> - elm_toolbar_item_add(tb, o, _("Servers"), NULL, NULL);
> -
> bbx = elm_box_add(_em_config_win);
> elm_box_horizontal_set(bbx, EINA_TRUE);
> elm_box_homogenous_set(bbx, EINA_TRUE);
>
> Modified: trunk/PROTO/emote/src/bin/em_config.h
> ===================================================================
> --- trunk/PROTO/emote/src/bin/em_config.h 2010-10-15 14:10:56 UTC (rev
> 53453)
> +++ trunk/PROTO/emote/src/bin/em_config.h 2010-10-15 15:57:19 UTC (rev
> 53454)
> @@ -38,8 +38,8 @@
> int version;
> };
>
> -EM_INTERN int em_config_init(void);
> -EM_INTERN int em_config_shutdown(void);
> +EM_INTERN Eina_Bool em_config_init(void);
> +EM_INTERN Eina_Bool em_config_shutdown(void);
> EM_INTERN Em_Config_DD *em_config_descriptor_new(const char *name, int size);
> EM_INTERN void em_config_load(void);
> EM_INTERN int em_config_save(void);
>
> Modified: trunk/PROTO/emote/src/bin/em_gui.c
> ===================================================================
> --- trunk/PROTO/emote/src/bin/em_gui.c 2010-10-15 14:10:56 UTC (rev 53453)
> +++ trunk/PROTO/emote/src/bin/em_gui.c 2010-10-15 15:57:19 UTC (rev 53454)
> @@ -4,8 +4,8 @@
> #define MIN_WIN_HEIGHT 200
>
> /* local function prototypes */
> -static Eina_Bool _em_gui_chansel_add_channel(const Eina_Hash *hash
> __UNUSED__, const void *key, void *data __UNUSED__, void *fdata __UNUSED__);
> -static Eina_Bool _em_gui_chansel_add_server(const Eina_Hash *hash
> __UNUSED__, const void *key, void *data __UNUSED__, void *fdata __UNUSED__);
> +static Eina_Bool _em_gui_chansel_add_channel(const Eina_Hash *hash
> __UNUSED__, const void *key, void *data, void *fdata __UNUSED__);
> +static Eina_Bool _em_gui_chansel_add_server(const Eina_Hash *hash
> __UNUSED__, const void *key, void *data, void *fdata __UNUSED__);
> static void _em_gui_chansel_update(const char *label);
> static void _em_gui_server_del(void *obj);
> static void _em_gui_server_free(void *obj);
> @@ -18,8 +18,8 @@
> static void _em_gui_server_entry_cb_enter(void *data, Evas_Object *obj, void
> *event __UNUSED__);
> static void _em_gui_channel_entry_cb_enter(void *data, Evas_Object *obj,
> void *event __UNUSED__);
> static void _em_gui_server_send_message(Emote_Protocol *p, const char
> *server, const char *nick, const char *text);
> -static void _em_gui_hoversel_cb_server_clicked(void *data, Evas_Object *obj
> __UNUSED__, void *event __UNUSED__);
> -static void _em_gui_hoversel_cb_channel_clicked(void *data, Evas_Object *obj
> __UNUSED__, void *event __UNUSED__);
> +static void _em_gui_chansel_cb_server_clicked(void *data, Evas_Object *obj
> __UNUSED__, void *event __UNUSED__);
> +static void _em_gui_chansel_cb_channel_clicked(void *data, Evas_Object *obj
> __UNUSED__, void *event __UNUSED__);
> static void _em_gui_switch(const char *server, const char *channel);
> static Em_Gui_Channel *_em_gui_channel_create(const char *server, const char
> *channel);
> static Em_Gui_Server *_em_gui_server_create(const char *server,
> Emote_Protocol *p);
> @@ -30,17 +30,17 @@
> static Em_Gui *gui = NULL;
>
> /* public functions */
> -EM_INTERN int
> +EM_INTERN Eina_Bool
> em_gui_init(void)
> {
> Evas_Object *o;
>
> /* allocate our object */
> gui = EM_OBJECT_ALLOC(Em_Gui, EM_GUI_TYPE, _em_gui_cb_free);
> - if (!gui) return 0;
> + if (!gui) return EINA_FALSE;
>
> // Set finger size to 4 to avoid huge widgets
> - elm_finger_size_set(4);
> +// elm_finger_size_set(4);
>
> /* create window */
> gui->w_win = elm_win_add(NULL, "emote", ELM_WIN_BASIC);
> @@ -52,53 +52,59 @@
> /* create background */
> o = elm_bg_add(gui->w_win);
> evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
> - evas_object_size_hint_min_set(o, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
> +// evas_object_size_hint_min_set(o, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
> elm_win_resize_object_add(gui->w_win, o);
> evas_object_show(o);
>
> /* create packing box */
> gui->w_box = elm_box_add(gui->w_win);
> - elm_box_horizontal_set(gui->w_box, EINA_FALSE);
> - elm_box_homogenous_set(gui->w_box, EINA_FALSE);
> - evas_object_size_hint_weight_set(gui->w_box, EVAS_HINT_EXPAND,
> EVAS_HINT_EXPAND);
> - evas_object_size_hint_align_set(gui->w_box, EVAS_HINT_FILL,
> EVAS_HINT_FILL);
> elm_win_resize_object_add(gui->w_win, gui->w_box);
> + evas_object_size_hint_weight_set(gui->w_box, EVAS_HINT_EXPAND,
> + EVAS_HINT_EXPAND);
> evas_object_show(gui->w_box);
>
> - /* create hover select at top for quick channel change */
> - gui->w_chansel = elm_hoversel_add(gui->w_win);
> - elm_hoversel_label_set(gui->w_chansel, _(""));
> - elm_hoversel_hover_parent_set(gui->w_chansel, gui->w_win);
> - evas_object_size_hint_weight_set(gui->w_chansel, 0.0, 0.0);
> - evas_object_size_hint_align_set(gui->w_chansel, EVAS_HINT_FILL,
> EVAS_HINT_FILL);
> - elm_box_pack_end(gui->w_box, gui->w_chansel);
> - evas_object_show(gui->w_chansel);
> -
> /* create main toolbar */
> gui->w_tb = elm_toolbar_add(gui->w_win);
> elm_toolbar_icon_size_set(gui->w_tb, (16 * elm_scale_get()));
> elm_toolbar_align_set(gui->w_tb, 0.0);
> - elm_toolbar_scrollable_set(gui->w_tb, EINA_FALSE);
> - evas_object_size_hint_weight_set(gui->w_tb, EVAS_HINT_EXPAND, 0.0);
> + elm_toolbar_mode_shrink_set(gui->w_tb, ELM_TOOLBAR_SHRINK_SCROLL);
> + evas_object_size_hint_weight_set(gui->w_tb, 0.0, 0.0);
> evas_object_size_hint_align_set(gui->w_tb, EVAS_HINT_FILL, 0.0);
> - elm_box_pack_end(gui->w_box, gui->w_tb);
> +
> + elm_toolbar_item_add(gui->w_tb, "preferences-system", _("Settings"),
> + _em_gui_cb_settings, NULL);
> + elm_toolbar_item_add(gui->w_tb, "application-exit", _("Quit"),
> + _em_gui_cb_quit, NULL);
> evas_object_show(gui->w_tb);
> + elm_box_pack_start(gui->w_box, gui->w_tb);
>
> - o = em_util_icon_add(gui->w_win, "preferences-system");
> - elm_toolbar_item_add(gui->w_tb, o, _("Settings"), _em_gui_cb_settings,
> NULL);
> - o = em_util_icon_add(gui->w_win, "application-exit");
> - elm_toolbar_item_add(gui->w_tb, o, _("Quit"), _em_gui_cb_quit, NULL);
> + /* create channel selector */
> + gui->w_chansel = elm_toolbar_add(gui->w_win);
> + elm_toolbar_homogenous_set(gui->w_chansel, EINA_FALSE);
> + elm_toolbar_align_set(gui->w_chansel, 0.0);
> + elm_toolbar_mode_shrink_set(gui->w_chansel, ELM_TOOLBAR_SHRINK_SCROLL);
> + evas_object_size_hint_weight_set(gui->w_chansel, 0.0, 0.0);
> + evas_object_size_hint_align_set(gui->w_chansel, EVAS_HINT_FILL, 0.0);
> + evas_object_show(gui->w_chansel);
> + elm_box_pack_end(gui->w_box, gui->w_chansel);
>
> /* set min size of window and show it */
> - evas_object_size_hint_min_set(gui->w_win, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
> +// evas_object_size_hint_min_set(gui->w_win, MIN_WIN_WIDTH,
> MIN_WIN_HEIGHT);
> evas_object_resize(gui->w_win, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
> evas_object_show(gui->w_win);
>
> gui->servers = eina_hash_string_small_new(_em_gui_server_del);
>
> - return 1;
> + return EINA_TRUE;
> }
>
> +EM_INTERN Eina_Bool
> +em_gui_shutdown(void)
> +{
> + if (gui) em_object_del(EM_OBJECT(gui));
> + return EINA_TRUE;
> +}
> +
> EM_INTERN void
> em_gui_server_add(const char *server, Emote_Protocol *p)
> {
> @@ -117,7 +123,7 @@
> {
> eina_hash_del_by_key(gui->servers, server);
>
> - if (gui->servers && eina_hash_population(gui->servers))
> + if ((gui->servers) && (eina_hash_population(gui->servers)))
> eina_hash_foreach(gui->servers, _em_gui_server_first_get, NULL);
> else
> _em_gui_chansel_update("");
> @@ -128,9 +134,7 @@
> {
> Em_Gui_Channel *c;
>
> - c = _em_gui_channel_create(server, channel);
> -
> - if (c)
> + if ((c = _em_gui_channel_create(server, channel)))
> _em_gui_switch(server, channel);
> }
>
> @@ -148,7 +152,7 @@
> EM_INTERN void
> em_gui_message_add(const char *server, const char *channel, const char
> *user, const char *text)
> {
> - char buf[4096];
> + char buf[PATH_MAX];
> Em_Gui_Server *s;
> Em_Gui_Channel *c;
>
> @@ -160,8 +164,7 @@
> s = eina_hash_find(gui->servers, server);
> if (channel)
> {
> - c = eina_hash_find(s->channels, channel);
> - if (c)
> + if ((c = eina_hash_find(s->channels, channel)))
> {
> elm_scrolled_entry_cursor_end_set(c->w_text);
> elm_scrolled_entry_entry_insert(c->w_text, buf);
> @@ -179,13 +182,6 @@
> }
> }
>
> -EM_INTERN int
> -em_gui_shutdown(void)
> -{
> - if (gui) em_object_del(EM_OBJECT(gui));
> - return 1;
> -}
> -
> static Eina_Bool
> _em_gui_channel_nick_update(const Eina_Hash *hash __UNUSED__, const void
> *key __UNUSED__, void *data, void *fdata)
> {
> @@ -197,11 +193,7 @@
> n = fdata;
>
> snprintf(buf, sizeof(buf), "You are now known as %s", n);
> - em_gui_message_add(c->server->name,
> - c->name,
> - NULL,
> - buf
> - );
> + em_gui_message_add(c->server->name, c->name, NULL, buf);
> elm_label_label_set(c->w_nick, n);
>
> return EINA_TRUE;
> @@ -215,21 +207,21 @@
>
> s = eina_hash_find(gui->servers, server);
>
> - if (!old || !strcmp(old, s->nick))
> - {
> - elm_label_label_set(s->w_nick, new);
> - eina_hash_foreach(s->channels, _em_gui_channel_nick_update, new);
> + if ((!old) || (!strcmp(old, s->nick)))
> + {
> + elm_label_label_set(s->w_nick, new);
> + eina_hash_foreach(s->channels, _em_gui_channel_nick_update, new);
>
> - if (s->nick) eina_stringshare_del(s->nick);
> - s->nick = eina_stringshare_add(new);
> - }
> + if (s->nick) eina_stringshare_del(s->nick);
> + s->nick = eina_stringshare_add(new);
> + }
> else
> - {
> - // TODO: Add way to track users in a channel so we can send this
> - // message to the relevant channels instead of server window
> - snprintf(buf, sizeof(buf), "%s is now known as %s", old, new);
> - em_gui_message_add(server, NULL, NULL, buf);
> - }
> + {
> + // TODO: Add way to track users in a channel so we can send this
> + // message to the relevant channels instead of server window
> + snprintf(buf, sizeof(buf), "%s is now known as %s", old, new);
> + em_gui_message_add(server, NULL, NULL, buf);
> + }
> }
>
> EM_INTERN void
> @@ -306,10 +298,10 @@
> snprintf(buf, sizeof(buf), "%s", users);
>
> if (!c)
> - {
> - printf("Server %p, Channel %p\n", s, c);
> - return;
> - }
> + {
> + printf("Server %p, Channel %p\n", s, c);
> + return;
> + }
>
> elm_scrolled_entry_cursor_end_set(c->w_text);
> elm_scrolled_entry_entry_insert(c->w_text, buf);
> @@ -319,28 +311,34 @@
>
> /* local functions */
> static Eina_Bool
> -_em_gui_chansel_add_channel(const Eina_Hash *hash __UNUSED__, const void
> *key, void *data __UNUSED__, void *fdata __UNUSED__)
> +_em_gui_chansel_add_channel(const Eina_Hash *hash __UNUSED__, const void
> *key, void *data, void *fdata __UNUSED__)
> {
> - Em_Gui_Channel *c;
> + Em_Gui_Channel *c;
>
> - c = data;
> + c = data;
> + if (!c->w_select)
> + {
> + c->w_select =
> + elm_toolbar_item_add(gui->w_chansel, NULL, key,
> + _em_gui_chansel_cb_channel_clicked, c);
> + }
>
> - c->w_select = elm_hoversel_item_add(gui->w_chansel, (const char *)key,
> NULL, ELM_ICON_NONE,
> - _em_gui_hoversel_cb_channel_clicked, c);
> -
> return EINA_TRUE;
> }
>
> static Eina_Bool
> -_em_gui_chansel_add_server(const Eina_Hash *hash __UNUSED__, const void
> *key, void *data __UNUSED__, void *fdata __UNUSED__)
> +_em_gui_chansel_add_server(const Eina_Hash *hash __UNUSED__, const void
> *key, void *data, void *fdata __UNUSED__)
> {
> - Em_Gui_Server *s;
> + Em_Gui_Server *s;
>
> - s = data;
> + s = data;
> + if (!s->w_select)
> + {
> + s->w_select =
> + elm_toolbar_item_add(gui->w_chansel, NULL, key,
> + _em_gui_chansel_cb_server_clicked, s);
> + }
>
> - s->w_select = elm_hoversel_item_add(gui->w_chansel, (const char *)key,
> NULL, [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel