[E-devel] Pager's desktop dnd + small fix on e_remember.c e_zone.c

2007-02-20 Thread lok
Hi there,

I've done a small patch for the pager, it allow the user to drag a desktop from
the pager, and drop it on the pager or on the current desktop. At the drop the
two desktops are switched. By default the button is desactivate.

More exactly, windows move from one desk to the other, and if there is a name
or a specific background setted on one of the desk. e_config is updated and
saved. Dnd across different zones is supported.

I found that useful when it come to sort desktops. I just hope that I'm not
the only one to think that :)

This patch also fix the warning at build time.
Also attached there's two small patch for little checks missing in e_remember.c
and e_zone.c

Any comments is welcome.

lokIndex: e_remember.c
===
RCS file: /cvs/e/e17/apps/e/src/bin/e_remember.c,v
retrieving revision 1.22
diff -u -r1.22 e_remember.c
--- e_remember.c	4 Jan 2007 10:30:55 -	1.22
+++ e_remember.c	20 Feb 2007 22:47:47 -
@@ -206,6 +206,7 @@
 EAPI void
 e_remember_update(E_Remember *rem, E_Border *bd)
 {
+   if (!rem) return;
if (bd-new_client) return;
if (rem-name) evas_stringshare_del(rem-name);
if (rem-class) evas_stringshare_del(rem-class);
Index: e_zone.c
===
RCS file: /cvs/e/e17/apps/e/src/bin/e_zone.c,v
retrieving revision 1.108
diff -u -r1.108 e_zone.c
--- e_zone.c	28 Jan 2007 07:22:50 -	1.108
+++ e_zone.c	20 Feb 2007 22:47:29 -
@@ -440,8 +440,8 @@
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);

-   *x_count = zone-desk_x_count;
-   *y_count = zone-desk_y_count;
+   if (x_count) *x_count = zone-desk_x_count;
+   if (y_count) *y_count = zone-desk_y_count;
 }
 
 EAPI void
? pager.patch
Index: e_mod_config.c
===
RCS file: /cvs/e/e17/apps/e/src/modules/pager/e_mod_config.c,v
retrieving revision 1.27
diff -u -r1.27 e_mod_config.c
--- e_mod_config.c	3 Feb 2007 02:02:49 -	1.27
+++ e_mod_config.c	20 Feb 2007 22:50:30 -
@@ -5,7 +5,8 @@
 enum _Pager_Grab_Button
 {
GRAB_BUTTON_DRAG,
-   GRAB_BUTTON_NOPLACE
+   GRAB_BUTTON_NOPLACE,
+   GRAB_BUTTON_DESK
 };
 
 struct _E_Config_Dialog_Data
@@ -15,6 +16,7 @@
int drag_resist;
unsigned char btn_drag;
unsigned char btn_noplace;
+   unsigned char btn_desk;
int flip_desk;
 
struct {
@@ -27,6 +29,7 @@
struct {
   Evas_Object *o_btn1;
   Evas_Object *o_btn2;
+  Evas_Object *o_btn3;
} gui;
 };
 
@@ -76,6 +79,7 @@
cfdata-drag_resist = pager_config-drag_resist;
cfdata-btn_drag = pager_config-btn_drag;
cfdata-btn_noplace = pager_config-btn_noplace;
+   cfdata-btn_desk = pager_config-btn_desk;
cfdata-flip_desk = pager_config-flip_desk;
 }
 
@@ -146,12 +150,17 @@
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
ob = e_widget_label_add(evas, _(Drag no place button));
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1);
+   ob = e_widget_label_add(evas, _(Drag desktop button));
+   e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _(Click to set), NULL, _grab_wnd_show, (void *)GRAB_BUTTON_DRAG, cfdata);
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 0, 0);
cfdata-gui.o_btn1 = ob;
ob = e_widget_button_add(evas, _(Click to set), NULL, _grab_wnd_show, (void *)GRAB_BUTTON_NOPLACE, cfdata);
e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 0, 0);
cfdata-gui.o_btn2 = ob;
+   ob = e_widget_button_add(evas, _(Click to set), NULL, _grab_wnd_show, (void *)GRAB_BUTTON_DESK, cfdata);
+   e_widget_frametable_object_append(of, ob, 2, 3, 1, 1, 1, 1, 0, 0);
+   cfdata-gui.o_btn3 = ob;
_advanced_update_button_label(cfdata);
e_widget_list_object_append(o, of, 1, 1, 0.5);   

@@ -171,6 +180,7 @@
pager_config-drag_resist = cfdata-drag_resist;
pager_config-btn_drag = cfdata-btn_drag;
pager_config-btn_noplace = cfdata-btn_noplace;
+   pager_config-btn_desk = cfdata-btn_desk;
pager_config-flip_desk = cfdata-flip_desk;
_pager_cb_config_updated();
e_config_save_queue();
@@ -193,6 +203,12 @@
else
  snprintf(label, sizeof(label), _(Click to set));
e_widget_button_label_set(cfdata-gui.o_btn2, label);
+   
+   if (cfdata-btn_desk)
+ snprintf(label, sizeof(label), _(Button %i), cfdata-btn_desk);
+   else
+ snprintf(label, sizeof(label), _(Click to set));
+   e_widget_button_label_set(cfdata-gui.o_btn3, label);
 }
 
 static void
@@ -206,6 +222,8 @@
 
if ((Pager_Grab_Button)data1 == GRAB_BUTTON_DRAG)
  cfdata-grab.btn = 1;
+   else if ((Pager_Grab_Button)data1 == GRAB_BUTTON_NOPLACE)
+ cfdata-grab.btn = 2;
else
  cfdata-grab.btn = 0;
 
@@ -265,8 +283,10 @@
  {
 	if (cfdata-grab.btn == 1)
 	  cfdata-btn_drag = ev-button;
-	else
+	else if (cfdata-grab.btn == 2)
 	  cfdata-btn_noplace = 

Re: [E-devel] Pager's desktop dnd + small fix on e_remember.c e_zone.c

2007-02-20 Thread Christopher Michael
The e_remember  e_zone patches are in cvs.

lok wrote:
 Hi there,
 
 I've done a small patch for the pager, it allow the user to drag a desktop 
 from
 the pager, and drop it on the pager or on the current desktop. At the drop the
 two desktops are switched. By default the button is desactivate.
 
 More exactly, windows move from one desk to the other, and if there is a name
 or a specific background setted on one of the desk. e_config is updated and
 saved. Dnd across different zones is supported.
 
 I found that useful when it come to sort desktops. I just hope that I'm not
 the only one to think that :)
 
 This patch also fix the warning at build time.
 Also attached there's two small patch for little checks missing in 
 e_remember.c
 and e_zone.c
 
 Any comments is welcome.
 
 lok
 

I've applied the e_remember  e_zone portions of this to cvs. I did not
apply the pager patch(s) because I'm not sure if this behavior is wanted.

Cheers,
dh

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel