Hi All,

In simple terms, this patch adds a func to return whether or not a dialog button is disabled.

Let me give some background as to why I created this patch. With Config Dialogs, when the Advanced section does not reproduce the Basic section, a problem occurs if the user changes a Basic setting and does not apply it, but instead clicks the Advanced section then back to the Basic section. Then any changes made in Basic are lost and it is returned to it's original values. I coded this patch so that in _advanced_create_widgets a check could be made to see if the apply button is disabled or not. Basically, the theory is that if the Basic Apply Button is not disabled, then a change was made and should be applied. There may be a different way that I should handle this case (adding Basic options to Advanced section comes to mind) but still, this function (e_dialog_button_disable_num_get) may come in handy somewhere down the line.

Cheers,
devilhorns

--- e_dialog.c.orig     2005-11-05 22:40:24.000000000 -0500
+++ e_dialog.c  2005-12-10 07:30:12.000000000 -0500
@@ -105,6 +105,17 @@
    return 1;
 }
 
+int
+e_dialog_button_disable_num_get(E_Dialog *dia, int button)
+{
+   Evas_Object *o;
+   int ret = 0;
+   
+   o = evas_list_nth(dia->buttons, button);
+   if (o) ret = e_widget_disabled_get(o);
+   return ret;
+}
+
 void
 e_dialog_title_set(E_Dialog *dia, char *title)
 {
--- e_dialog.h.orig     2005-11-05 22:40:24.000000000 -0500
+++ e_dialog.h  2005-12-10 07:27:31.000000000 -0500
@@ -7,15 +7,15 @@
 typedef struct _E_Dialog_Button E_Dialog_Button;
 
 #else
-#ifndef E_DIALOG_H
-#define E_DIALOG_H
+# ifndef E_DIALOG_H
+#  define E_DIALOG_H
 
-#define E_DIALOG_TYPE 0xE0b01012
+#  define E_DIALOG_TYPE 0xE0b01012
 
 struct _E_Dialog
 {
    E_Object             e_obj_inherit;
-   
+
    E_Win               *win;
    Evas_Object         *bg_object;
    Evas_Object         *box_object;
@@ -33,12 +33,13 @@
 EAPI void      e_dialog_button_add             (E_Dialog *dia, char *label, 
char *icon, void (*func) (void *data, E_Dialog *dia), void *data);
 EAPI int       e_dialog_button_focus_num       (E_Dialog *dia, int button);
 EAPI int       e_dialog_button_disable_num_set (E_Dialog *dia, int button, int 
disabled);
+EAPI int       e_dialog_button_disable_num_get (E_Dialog *dia, int button);
 EAPI void      e_dialog_title_set              (E_Dialog *dia, char *title);
 EAPI void      e_dialog_text_set               (E_Dialog *dia, char *text);
 EAPI void      e_dialog_icon_set               (E_Dialog *dia, char *icon, 
Evas_Coord size);
 EAPI void      e_dialog_content_set            (E_Dialog *dia, Evas_Object 
*obj, Evas_Coord minw, Evas_Coord minh);
 EAPI void      e_dialog_resizable_set          (E_Dialog *dia, int resizable);
 EAPI void      e_dialog_show                   (E_Dialog *dia);
-    
-#endif
+
+# endif
 #endif

Reply via email to