bigboard r7250 - in trunk: . applet



Author: otaylor
Date: Mon Feb  4 20:33:31 2008
New Revision: 7250
URL: http://svn.gnome.org/viewvc/bigboard?rev=7250&view=rev

Log:
bigboard-button.c: Hide the contents of the applet unless we are in minimized-sidebar mode
  (it was very confusing that clicking on the button *put you into* minimzed-sidebar mode)
main.py: Add a mention of the panel button to the first time minimize dialog (needs 
  serious work to make it more friendly, show a picture of the button, etc.)


Modified:
   trunk/applet/bigboard-button.c
   trunk/main.py

Modified: trunk/applet/bigboard-button.c
==============================================================================
--- trunk/applet/bigboard-button.c	(original)
+++ trunk/applet/bigboard-button.c	Mon Feb  4 20:33:31 2008
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
 #include <panel-applet.h>
 #include "hippo-dbus-helper.h"
 #include <dbus/dbus-glib-lowlevel.h>
@@ -36,6 +37,8 @@
 
 #define ICON_NAME GTK_STOCK_MISSING_IMAGE
 
+#define BIGBOARD_GCONF_DIR "/apps/bigboard"
+
 static void
 wncklet_set_tooltip (GtkWidget  *widget,
                      const char *tip)
@@ -103,43 +106,6 @@
 }
 
 static void
-wncklet_display_help (GtkWidget  *widget,
-                      const char *doc_id,
-                      const char *filename,
-                      const char *link_id)
-{
-#if 0
-        GError *error = NULL;
-
-        gnome_help_display_desktop_on_screen (NULL, doc_id, filename, link_id,
-                                              gtk_widget_get_screen (widget),
-                                              &error);
-
-        if (error) {
-                GtkWidget *dialog;
-
-                dialog = gtk_message_dialog_new (NULL,
-                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                 GTK_MESSAGE_ERROR,
-                                                 GTK_BUTTONS_OK,
-                                                 _("There was an error displaying help: %s"),
-                                                 error->message);
-
-                g_signal_connect (dialog, "response",
-                                  G_CALLBACK (gtk_widget_destroy),
-                                  NULL);
-
-                gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-                gtk_window_set_screen (GTK_WINDOW (dialog),
-                                       gtk_widget_get_screen (widget));
-                gtk_widget_show (dialog);
-                g_error_free (error);
-        }
-#endif
-}
-
-
-static void
 wncklet_connect_while_alive (gpointer    object,
                              const char *signal,
                              GCallback   func,
@@ -174,6 +140,9 @@
         GtkIconTheme *icon_theme;
         GdkPixbuf *user_photo;
 
+        gboolean bigboard_visible;
+        guint visible_notify;
+        
         DBusConnection *connection;
         HippoDBusProxy *bb_proxy;
 
@@ -504,6 +473,9 @@
 static void
 update_button_state (ButtonData *button_data)
 {
+        if (!button_data->button)
+                return;
+        
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_data->button), button_data->showing_bigboard);
         update_button_display (button_data);
 }
@@ -540,6 +512,12 @@
                 button_data->connection = NULL;
         }
 
+        if (button_data->visible_notify) {
+                gconf_client_notify_remove(gconf_client_get_default(),
+                                           button_data->visible_notify);
+                button_data->visible_notify = 0;
+        }
+
         if (button_data->about_dialog) {
                 gtk_widget_destroy (button_data->about_dialog);
                 button_data->about_dialog =  NULL;
@@ -675,26 +653,12 @@
         update_button_display (button_data);
 }
 
-static ButtonData*
-bigboard_button_add_to_widget (GtkWidget *applet)
+static void
+create_content(ButtonData *button_data)
 {
-        ButtonData *button_data;
         AtkObject  *atk_obj;
         GtkWidget  *hbox;
-
-        button_data = g_new0 (ButtonData, 1);
-
-        button_data->applet = applet;
-
-        button_data->image = gtk_image_new ();
-
-        button_data->orient = GTK_ORIENTATION_HORIZONTAL;
-
-        button_data->size = 24;
-
-        g_signal_connect (G_OBJECT (button_data->applet), "realize",
-                          G_CALLBACK (bigboard_button_applet_realized), button_data);
-
+        
         button_data->button = gtk_toggle_button_new ();
 
         gtk_widget_set_name (button_data->button, "bigboard-button");
@@ -767,6 +731,66 @@
         self_add_icon_changed_callback(user_photo_changed_callback, button_data);
 
         gtk_widget_show_all (hbox);
+}
+
+static void
+on_visible_changed (GConfClient*   client,
+                    guint          connection_id,
+                    GConfEntry    *entry,
+                    gpointer       user_data)
+{
+        ButtonData *button_data = user_data;
+        gboolean bigboard_visible = gconf_client_get_bool(client, BIGBOARD_GCONF_DIR "/visible", NULL);
+        if (bigboard_visible != button_data->bigboard_visible) {
+                button_data->bigboard_visible = bigboard_visible;
+                
+                if (!bigboard_visible) {
+                        if (!button_data->button)
+                                create_content(button_data);
+                        
+                        gtk_widget_show(button_data->button);
+                        gtk_widget_show(button_data->launchers);
+                } else {
+                        gtk_widget_hide(button_data->button);
+                        gtk_widget_hide(button_data->launchers);
+                }
+        }
+}
+
+static ButtonData*
+bigboard_button_add_to_widget (GtkWidget *applet)
+{
+        ButtonData *button_data;
+        GConfClient *gconf_client;
+
+        button_data = g_new0 (ButtonData, 1);
+
+        button_data->applet = applet;
+
+        button_data->image = gtk_image_new ();
+
+        button_data->orient = GTK_ORIENTATION_HORIZONTAL;
+
+        button_data->size = 24;
+
+        g_signal_connect (G_OBJECT (button_data->applet), "realize",
+                          G_CALLBACK (bigboard_button_applet_realized), button_data);
+
+        gconf_client = gconf_client_get_default ();
+
+        gconf_client_add_dir(gconf_client,
+                             BIGBOARD_GCONF_DIR,
+                             GCONF_CLIENT_PRELOAD_NONE,
+                             NULL);
+        
+        button_data->visible_notify = gconf_client_notify_add(gconf_client,
+                                                              BIGBOARD_GCONF_DIR "/visible",
+                                                              on_visible_changed, button_data, NULL, NULL);
+        
+        button_data->bigboard_visible = gconf_client_get_bool(gconf_client,
+                                                              BIGBOARD_GCONF_DIR "/visible", NULL);
+        if (!button_data->bigboard_visible)
+                create_content(button_data);
 
         return button_data;
 }

Modified: trunk/main.py
==============================================================================
--- trunk/main.py	(original)
+++ trunk/main.py	Mon Feb  4 20:33:31 2008
@@ -105,7 +105,7 @@
         img = gtk.Image()
         img.set_from_file(img_filename)
         hbox.add(img)
-        hbox.add(gtk.Label('''The sidebar is now hidden; press the key shown on the left to pop it
+        hbox.add(gtk.Label('''The sidebar is now hidden; press the key shown on the left or the panel button to pop it
 back up temporarily.'''))
         self.connect('response', self.__on_response)
         



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