Add a desktop settings dialog - needs a nice preview of the desks (which will fix...
authorhandyande <handyande>
Mon, 21 Nov 2005 12:44:19 +0000 (12:44 +0000)
committerhandyande <handyande@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 21 Nov 2005 12:44:19 +0000 (12:44 +0000)
works though :)

SVN revision: 18575

src/bin/Makefile.am
src/bin/e_configure.c
src/bin/e_includes.h
src/bin/e_int_config_desks.c [new file with mode: 0644]
src/bin/e_int_config_desks.h [new file with mode: 0644]

index 1ff808b..513d254 100644 (file)
@@ -76,7 +76,6 @@ e_remember.h \
 e_win.h \
 e_pan.h \
 e_dialog.h \
-e_configure.h \
 e_about.h \
 e_theme_about.h \
 e_apps_cache.h \
@@ -98,6 +97,8 @@ e_widget_entry.h \
 e_widget_image.h \
 e_config_dialog.h \
 e_int_config_focus.h \
+e_int_config_desks.h \
+e_configure.h \
 e_icon_layout.h \
 e_int_border_locks.h \
 e_thumb.h \
@@ -173,7 +174,6 @@ e_remember.c \
 e_win.c \
 e_pan.c \
 e_dialog.c \
-e_configure.c \
 e_about.c \
 e_theme_about.c \
 e_apps_cache.c \
@@ -195,6 +195,8 @@ e_widget_entry.c \
 e_widget_image.c \
 e_config_dialog.c \
 e_int_config_focus.c \
+e_int_config_desks.c \
+e_configure.c \
 e_icon_layout.c \
 e_int_border_locks.c \
 e_thumb.c \
index 92e6632..3c4a5d3 100644 (file)
@@ -59,6 +59,7 @@ e_configure_show(E_Container *con)
 
    /* add items here */
    e_configure_standard_item_add(eco, "enlightenment/e", _("Focus Settings"), e_int_config_focus);
+   e_configure_standard_item_add(eco, "enlightenment/e", _("Desktop Settings"), e_int_config_desks);
    e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation);
    e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display);
    
index 1cc40b2..a696b2d 100644 (file)
@@ -79,6 +79,7 @@
 #include "e_widget_iconsel.h"
 #include "e_config_dialog.h"
 #include "e_int_config_focus.h"
+#include "e_int_config_desks.h"
 #include "e_icon_layout.h"
 #include "e_int_border_locks.h"
 #include "e_thumb.h"
diff --git a/src/bin/e_int_config_desks.c b/src/bin/e_int_config_desks.c
new file mode 100644 (file)
index 0000000..2b09439
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+/* PROTOTYPES - same all the time */
+typedef struct _CFData CFData;
+
+static void *_create_data(E_Config_Dialog *cfd);
+static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
+static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
+static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
+
+/* Actual config data we will be playing with whil the dialog is active */
+struct _CFData
+{
+   /*- BASIC -*/
+   int x;
+   int y;
+   /*- ADVANCED -*/
+   int edge_flip;
+   double resistance;
+};
+
+/* a nice easy setup function that does the dirty work */
+E_Config_Dialog *
+e_int_config_desks(E_Container *con)
+{
+   E_Config_Dialog *cfd;
+   E_Config_Dialog_View v;
+   
+   /* methods */
+   v.create_cfdata           = _create_data;
+   v.free_cfdata             = _free_data;
+   v.basic.apply_cfdata      = _basic_apply_data;
+   v.basic.create_widgets    = _basic_create_widgets;
+   v.advanced.apply_cfdata   = _advanced_apply_data;
+   v.advanced.create_widgets = _advanced_create_widgets;
+   /* create config diaolg for NULL object/data */
+   cfd = e_config_dialog_new(con, _("Desktop Settings"), NULL, 0, &v, NULL);
+   return cfd;
+}
+
+/**--CREATE--**/
+static void
+_fill_data(CFData *cfdata)
+{
+   cfdata->x = e_config->zone_desks_x_count;
+   cfdata->y = e_config->zone_desks_y_count;
+   cfdata->edge_flip = e_config->use_edge_flip;
+   cfdata->resistance = e_config->edge_flip_timeout;
+}
+
+static void *
+_create_data(E_Config_Dialog *cdd)
+{
+   /* Create cfdata - cfdata is a temporary block of config data that this
+    * dialog will be dealing with while configuring. it will be applied to
+    * the running systems/config in the apply methods
+    */
+   CFData *cfdata;
+   
+   cfdata = E_NEW(CFData, 1);
+   _fill_data(cfdata);
+   return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cdd, CFData *cfdata)
+{
+   /* Free the cfdata */
+   free(cfdata);
+}
+
+/**--APPLY--**/
+static int
+_basic_apply_data(E_Config_Dialog *cdd, CFData *cfdata)
+{
+   /* Actually take our cfdata settings and apply them in real life */
+   Evas_List *l, *ll, *lll;
+   E_Manager *man;
+   E_Container *con;
+   E_Zone *zone;
+
+   for (l = e_manager_list(); l; l = l->next)
+     {
+       man = l->data;
+       for (ll = man->containers; ll; ll = ll->next)
+         {
+            con = ll->data;
+            for (lll = con ->zones; lll; lll = lll->next)
+              {
+                 zone = lll->data;
+                 e_zone_desk_count_set(zone, cfdata->x, cfdata->y);
+              }
+         }
+     }
+
+   e_config_save_queue();
+   return 1; /* Apply was OK */
+}
+
+static int
+_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
+{
+   /* Actually take our cfdata settings and apply them in real life */
+   e_config->use_edge_flip = cfdata->edge_flip;
+   e_config->edge_flip_timeout = cfdata->resistance;
+
+   e_zone_update_flip_all();
+   e_config_save_queue();
+   return 1; /* Apply was OK */
+}
+
+/**--GUI--**/
+static Evas_Object *
+_basic_create_widgets(E_Config_Dialog *cdd, Evas *evas, CFData *cfdata)
+{
+   /* generate the core widget layout for a basic dialog */
+   Evas_Object *o, *ob, *of;
+   E_Radio_Group *rg;
+   
+   _fill_data(cfdata);
+   
+   o = e_widget_list_add(evas, 0, 0);
+
+   of = e_widget_framelist_add(evas, _("Number of desktops"), 0);
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.0f wide"), 0.0, 10.0, 1.0, 0, NULL, &(cfdata->x), 100);
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_slider_add(evas, 0, 0, _("%1.0f high"), 0.0, 10.0, 1.0, 0, NULL, &(cfdata->y), 100);
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   return o;
+}
+
+static Evas_Object *
+_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
+{
+   /* generate the core widget layout for an advanced dialog */
+   Evas_Object *o, *ob, *of;
+   E_Radio_Group *rg;
+   
+   _fill_data(cfdata);
+   
+   o = e_widget_list_add(evas, 0, 0);
+   
+   of = e_widget_framelist_add(evas, _("Edge Flip"), 0);
+   ob = e_widget_check_add(evas, _("Flip desktops when mouse leaves the screen"), &(cfdata->edge_flip));
+   e_widget_framelist_object_append(of, ob);
+
+   ob = e_widget_label_add(evas, _("Delay before flipping:"));
+   e_widget_framelist_object_append(of, ob);
+
+   ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 4.9, 0.1, 0, &(cfdata->resistance), NULL, 200);
+   e_widget_framelist_object_append(of, ob);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
+   return o;
+}
diff --git a/src/bin/e_int_config_desks.h b/src/bin/e_int_config_desks.h
new file mode 100644 (file)
index 0000000..e0dcdfd
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_INT_CONFIG_DESKS_H
+#define E_INT_CONFIG_DESKS_H
+
+EAPI E_Config_Dialog *e_int_config_desks(E_Container *con);
+
+#endif
+#endif