ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src status.c,1.45,1.46 util.c,1.44,1.45 util


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src status.c,1.45,1.46 util.c,1.44,1.45 util.h,1.23,1.24
Date: Sun, 09 Feb 2003 04:58:07 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv7030/src

Modified Files:
        status.c util.c util.h 
Log Message:
better setting of menu sensitivity


Index: status.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/status.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- status.c    6 Feb 2003 10:08:51 -0000       1.45
+++ status.c    9 Feb 2003 09:58:04 -0000       1.46
@@ -58,6 +58,7 @@
 #include "pixmaps/logoff_icon.xpm"
 
 void update_contact_list();
+static void set_menu_sensitivity(void);
 
 enum {
        TARGET_STRING,
@@ -554,6 +555,7 @@
                eb_timeout_add(10000, (GtkFunction)contact_mgmt_flush, 
(gpointer)s->ela);
        }
 
+       set_menu_sensitivity();
 }
 
 void eb_sign_on_all() 
@@ -565,6 +567,7 @@
                        RUN_SERVICE(ac)->login(ac) ;
                node = node->next ;
        }
+       set_menu_sensitivity();
 }
 
 void eb_sign_off_all() 
@@ -576,6 +579,7 @@
                        RUN_SERVICE(ac)->logout(ac) ;
                node = node->next ;
        }
+       set_menu_sensitivity();
 
 }
 
@@ -1597,6 +1601,34 @@
 
 static GtkItemFactory *main_menu_factory = NULL;
 
+static void menu_set_sensitive(GtkItemFactory *ifactory, const gchar *path,
+                       gboolean sensitive)
+{
+       GtkWidget *widget;
+
+       g_return_if_fail(ifactory != NULL);
+
+       widget = gtk_item_factory_get_item(ifactory, path);
+       if(widget == NULL) {
+               printf("unknown menu entry %s\n", path);
+               return;
+       }
+       gtk_widget_set_sensitive(widget, sensitive);
+}
+
+
+static void set_menu_sensitivity(void)
+{
+       int online = connected_local_accounts();
+       
+       menu_set_sensitive(main_menu_factory, _("/Tools/New group chat..."), 
online);
+       menu_set_sensitive(main_menu_factory, _("/Tools/Set as away"), online);
+       menu_set_sensitive(main_menu_factory, _("/File/Sign off all"), online);
+       menu_set_sensitive(main_menu_factory, _("/File/Sign on all"),
+                               (online != l_list_length(accounts)));
+       
+}
+
 static gchar *menu_translate(const gchar *path, gpointer data)
 {
        gchar *retval;
@@ -1786,6 +1818,8 @@
        gtk_signal_connect(GTK_OBJECT(contact_window), "size_allocate",
                        eb_save_size,NULL);
        update_contact_list ();
+       
+       set_menu_sensitivity();
 }
 
 

Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- util.c      7 Feb 2003 08:25:33 -0000       1.44
+++ util.c      9 Feb 2003 09:58:04 -0000       1.45
@@ -468,6 +468,18 @@
        return NULL;
 }
 
+int connected_local_accounts(void)
+{
+       int n = 0;
+       LList *node = NULL;
+       for( node = accounts; node; node = node->next ) {
+               eb_local_account * ela = node->data;
+               if (ela->connected)
+                       n++;
+       }
+       return n;
+}
+
 eb_local_account * find_suitable_local_account( eb_local_account * first, int 
second )
 {
        LList * node;

Index: util.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- util.h      6 Feb 2003 08:52:42 -0000       1.23
+++ util.h      9 Feb 2003 09:58:04 -0000       1.24
@@ -118,6 +118,7 @@
 void invite_dialog( eb_local_account * ela, char * user, char * chat_room,
                    void * id );
 void make_safe_filename(char *buff, char *name, char *group);
+int connected_local_accounts(void);
 
 pid_t create_lock_file(char* fname);
 void delete_lock_file(char* fname);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]