[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] taskbar 0.1.3



Morten Nilsen wrote:
> http://home.4th-age.com/taskbar-0.1.3.tar.bz2
> 
> fixes:
> - Reworded config
> - Made initial preparations for i18n
> - Now remembers config
> - config should now work per taskbar client, but I haven't tested it

This patch fixes the callbacks working on all the instances rather than
the first found.

-- 
Cheers,
Morten
:wq
diff -ur taskbar-0.1.3/configure.in taskbar-0.1.4/configure.in
--- taskbar-0.1.3/configure.in	2006-06-16 01:30:05.000000000 +0200
+++ taskbar-0.1.4/configure.in	2006-06-16 01:47:25.508889436 +0200
@@ -7,7 +7,7 @@
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
-AM_INIT_AUTOMAKE(taskbar, 0.1.3)
+AM_INIT_AUTOMAKE(taskbar, 0.1.4)
 AM_CONFIG_HEADER(config.h)
 AC_ISC_POSIX
 AC_PROG_CC
diff -ur taskbar-0.1.3/e_mod_main.c taskbar-0.1.4/e_mod_main.c
--- taskbar-0.1.3/e_mod_main.c	2006-06-16 01:22:45.000000000 +0200
+++ taskbar-0.1.4/e_mod_main.c	2006-06-16 02:35:08.899548697 +0200
@@ -93,7 +93,6 @@
 static void _taskbar_icon_fill(Taskbar_Icon *ic);
 static void _taskbar_icon_empty(Taskbar_Icon *ic);
 static void _taskbar_icon_signal_emit(Taskbar_Icon *ic, char *sig, char *src);
-static Taskbar *_taskbar_zone_find(E_Zone *zone);
 static int _taskbar_cb_timer_drop_recalc(void *data);
 static void _taskbar_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _taskbar_inst_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -548,21 +547,6 @@
    if (ic->o_icon2)   edje_object_signal_emit(ic->o_icon2,   sig, src);
 }
 
-static Taskbar *
-_taskbar_zone_find(E_Zone *zone)
-{
-   Evas_List *l;
-   
-   for (l = taskbar_config->instances; l; l = l->next)
-     {
-	Instance *inst;
-
-	inst = l->data;
-	if (inst->taskbar->zone == zone) return inst->taskbar;
-     }
-   return NULL;
-}
-
 static int
 _taskbar_cb_timer_drop_recalc(void *data)
 {
@@ -1052,22 +1036,35 @@
 _taskbar_cb_event_border_add(void *data, int type, void *event)
 {
    E_Event_Border_Add *ev;
+   E_Desk *d;
    Taskbar *b;
    Taskbar_Icon *ic;
-   
+   Evas_List *l;
+
    ev = event;
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   if (_taskbar_icon_find(b, ev->border)) return 1;
+   d = e_desk_current_get(ev->border->zone);
+
    if (ev->border->client.netwm.state.skip_taskbar) return 1;
    if (ev->border->user_skip_winlist) return 1;
-   if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
-      !(ev->border->sticky || b->show_all)) return 1;
 
-   ic = _taskbar_icon_new(b, ev->border);
-   if (!ic) return 1;
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+        if (b->zone == ev->border->zone)
+	   {
+	     if (_taskbar_icon_find(b, ev->border)) continue;
+	     if ((ev->border->desk != d) && !(ev->border->sticky || b->show_all)) continue;
+
+	     ic = _taskbar_icon_new(b, ev->border);
+	     if (!ic) continue;
+
+	     _taskbar_icon_add(b, ic);
+	   }
+     }
 
-   _taskbar_icon_add(b, ic);
    return 1;
 }
 
@@ -1077,14 +1074,21 @@
    E_Event_Border_Remove *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* find icon and remove if there */
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_remove(b, ic);
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_remove(b, ic);
+     }
+
    return 1;
 }
 
@@ -1094,14 +1098,22 @@
    E_Event_Border_Iconify *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* do some sort of anim when iconifying */ 
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_signal_emit(ic, "iconify", "");
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_remove(b, ic);
+	_taskbar_icon_signal_emit(ic, "iconify", "");
+     }
+
    return 1;
 }
 
@@ -1111,14 +1123,22 @@
    E_Event_Border_Uniconify *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* do some sort of anim when uniconifying */ 
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_signal_emit(ic, "uniconify", "");
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_remove(b, ic);
+	_taskbar_icon_signal_emit(ic, "uniconify", "");
+     }
+
    return 1;
 }
 
@@ -1128,32 +1148,37 @@
    E_Event_Border_Icon_Change *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
-   /* update icon */
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
+   /* do some sort of anim when uniconifying */ 
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
 
-   if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
-      !(ev->border->sticky || b->show_all)) return 1;
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
+	   !(ev->border->sticky || b->show_all)) continue;
+
+	if (ev->border->client.netwm.state.skip_taskbar || 
+	    ev->border->user_skip_winlist)
+	  {
+	     if (ic) _taskbar_icon_remove(b, ic);
+	     continue;
+	  }
+	else if(!ic)
+	  {
+	     ic = _taskbar_icon_new(b, ev->border);
+	     _taskbar_icon_add(b, ic);
+	     continue;
+	  }
 
-   if (ev->border->client.netwm.state.skip_taskbar || 
-       ev->border->user_skip_winlist)
-     {
-	if (ic) _taskbar_icon_remove(b, ic);
-	return 1;
-     }
-   else if(!ic)
-     {
-	ic = _taskbar_icon_new(b, ev->border);
-	_taskbar_icon_add(b, ic);
-	return 1;
+	_taskbar_icon_empty(ic);
+	_taskbar_icon_fill(ic);
      }
 
-   _taskbar_icon_empty(ic);
-   _taskbar_icon_fill(ic);
-
    return 1;
 }
 
@@ -1207,29 +1232,36 @@
    Taskbar *b;
    Taskbar_Icon *ic;
    E_Border *bd;
+   Evas_List *l;
+
    ev = event;
    bd = ev->border;
    if (!bd) return 1;
    if (bd->user_skip_winlist) return 1;
    if (bd->client.netwm.state.skip_taskbar) return 1;
-   /* do some sort of anim when uniconifying */ 
-   b = _taskbar_zone_find(bd->zone);
-   if (!b) return 1;
 
-   if ((ev->border->desk == e_desk_current_get(ev->border->zone) && (b->zone == ev->border->zone)) ||
-       (bd->sticky) ||
-       (b->show_all))
-     {
-	ic = _taskbar_icon_find(b, bd);
-	if (ic) return 1;
-	ic = _taskbar_icon_new(b, ev->border);
-	_taskbar_icon_add(b, ic);
-     }
-   else
+   /* do some sort of anim when uniconifying */ 
+   for (l = taskbar_config->instances; l; l = l->next)
      {
-	ic = _taskbar_icon_find(b, bd);
-	if (!ic) return 1;
-	_taskbar_icon_remove(b, ic);
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	if ((ev->border->desk == e_desk_current_get(ev->border->zone) && (b->zone == ev->border->zone)) ||
+	    (bd->sticky) ||
+	    (b->show_all))
+	  {
+	     ic = _taskbar_icon_find(b, bd);
+	     if (ic) continue;
+	     ic = _taskbar_icon_new(b, ev->border);
+	     _taskbar_icon_add(b, ic);
+	  }
+	else
+	  {
+	     ic = _taskbar_icon_find(b, bd);
+	     if (!ic) continue;
+	     _taskbar_icon_remove(b, ic);
+	  }
      }
    return 1;
 }
@@ -1285,19 +1317,24 @@
 static int
 _taskbar_cb_event_desk_show(void *data, int type, void *event)
 {
+   Evas_List *l;
    E_Event_Desk_Show *e;
    Taskbar *b;
 
-
    e = event;
-   b = _taskbar_zone_find(e->desk->zone);
-   if (!b) return 1;
-   if (b->show_all) return 1;
-   _taskbar_empty(b);
-   _taskbar_empty_handle(b);
-   _taskbar_fill(b);
-   _taskbar_resize_handle(b);
-   _gc_orient(b->inst->gcc);
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+	Instance *inst;
+
+	inst = l->data;
+	if (inst->taskbar->zone == e->desk->zone && !(inst->taskbar->show_all))
+	   {
+	     _taskbar_empty(inst->taskbar);
+	     _taskbar_fill(inst->taskbar);
+	     _taskbar_resize_handle(inst->taskbar);
+	     _gc_orient(inst->gcc);
+	   }
+     }
    return 1;
 }