Enlightenment CVS committal

Author  : rhapsodhy
Project : e17
Module  : proto

Dir     : e17/proto/entrance_edit_gui/src/gui


Modified Files:
        Makefile.am background.c layout.c 


Log Message:

Notice dialogs added...

===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- Makefile.am 13 Aug 2006 04:38:58 -0000      1.6
+++ Makefile.am 13 Aug 2006 17:00:15 -0000      1.7
@@ -13,8 +13,8 @@
 
 entrance_edit_gui_CFLAGS = \
  -I$(top_srcdir)/src/widgets \
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@ 
[EMAIL PROTECTED]@ this line broke the build for me
 
 entrance_edit_gui_LDFLAGS = \
  -L$(top_srcdir)/src/widgets
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/background.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- background.c        13 Aug 2006 02:48:19 -0000      1.2
+++ background.c        13 Aug 2006 17:00:15 -0000      1.3
@@ -1,7 +1,133 @@
+#include <limits.h>
+#include <Ecore_File.h>
+#include <Ecore_Data.h>
 #include <Entrance_Widgets.h>
-#include <stdio.h>
+#include <Entrance_Edit.h>
+
+static void _background_cb_selected(void);
+static void _background_cb_ok(void *, void *);
+static void _background_cb_apply(void *, void *);
+static void _background_cb_close(void *, void *);
+
+static char* _background_get_path(const char *);
+static void _background_close(void);
+static void _background_apply(void);
+
+static Entrance_Dialog win;
+static Entrance_Widget img_preview;
+static Entrance_List list_thumbs;
+static Entrance_Widget group_backgrounds;
+static Entrance_Widget group_preview;
+static Entrance_Widget group_options;
 
 void
-egui_background_dialog_show() {
-printf("Background clicked\n");
+egui_background_dialog_show()
+{
+   Ecore_List *backgrounds;
+   char *background;
+   
+   win = ew_dialog_new(_("Entrance - Background Chooser"), EW_FALSE);
+
+   group_preview = ew_dialog_group_add(win, _("Preview"));
+
+   img_preview = ew_image_new(320, 240);
+   ew_group_add(group_preview, img_preview);
+
+   group_backgrounds = ew_dialog_group_add(win, _("Backgrounds"));
+
+   list_thumbs = ew_textlist_new(NULL, 320, 140, 20, 90);
+   
+   /* scan for backgrounds and add them to the list */
+   backgrounds = ecore_file_ls("/usr/share/entrance/backgrounds");
+   if(!backgrounds || ecore_list_is_empty(backgrounds))
+     return;
+
+   background = ecore_list_first(backgrounds);
+   char *background_file = _background_get_path(background);
+   ew_image_edje_load(img_preview, background_file, "Preview");
+   free(background_file);
+   /*FIXME: selecting the first row doesn't work - maybe we select first row 
while adding elements to the list:(*/
+   ew_list_first_row_select(list_thumbs);
+
+   ecore_list_goto_first(backgrounds);
+   while((background = ecore_list_next(backgrounds)))
+     {
+        char *background_no_ext = ecore_file_strip_ext(background);
+               ew_textlist_add(list_thumbs, background_no_ext, background, 
strlen(background) + 1, _background_cb_selected);
+
+        free(background_no_ext);
+     }
+   ecore_list_destroy(backgrounds);
+   
+   ew_group_add(group_backgrounds, list_thumbs);
+
+   /*Entrance_Widget group_options = ew_dialog_group_add(win, _("Options"));*/
+   
+   ew_dialog_close_button_add(win, _background_cb_close, NULL);
+   ew_dialog_apply_button_add(win, _background_cb_apply, NULL);
+   ew_dialog_ok_button_add(win, _background_cb_ok, NULL);
+   
+   ew_dialog_show(win);
+}
+
+static void
+_background_cb_selected()
+{
+       char* background = ew_list_selected_data_get(list_thumbs);
+       char* background_path = _background_get_path(background);
+       ew_image_edje_load(img_preview, background_path, "Preview");
+
+       free(background_path);
+}
+
+
+static void
+_background_cb_ok(void *object, void *data)
+{
+   _background_apply();
+   _background_close();
+}
+
+static void
+_background_cb_apply(void *object, void *data)
+{
+   _background_apply();
+}
+
+static void
+_background_cb_close(void *object, void *data)
+{
+       _background_close();
+}
+
+static char*
+_background_get_path(const char *t)
+{
+       char *path = calloc(PATH_MAX, sizeof(*path));
+       snprintf(path, PATH_MAX, "/usr/share/entrance/backgrounds/%s", t);
+
+       return path;
+}
+
+static void 
+_background_apply(void)
+{
+    char *background = ew_list_selected_data_get(list_thumbs);
+       if(!background) 
+       {
+               printf("Error. Please select a background first\n");
+               return;
+       }
+
+       entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_THEME_STR, 
background);
+       if(!entrance_edit_save())
+       {
+               printf("Error setting background - %s. Please check your 
permissions\n", background);
+       }
+}
+
+static void
+_background_close(void)
+{
+       ew_dialog_destroy(win);
 }
===================================================================
RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/layout.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- layout.c    13 Aug 2006 02:48:19 -0000      1.2
+++ layout.c    13 Aug 2006 17:00:15 -0000      1.3
@@ -3,6 +3,10 @@
 
 void
 egui_layout_dialog_show() {
-       printf("Layout clicked\n");
+       Entrance_Notice en = ew_notice_new(ENTRANCE_NOTICE_MESSAGE_DIALOG, 
"notice", "This is a message", NULL);
+       if(en) {
+       ew_notice_ok_button_add(en, NULL);
+       ew_notice_show(en);
+       }
 }
 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to