[accounts-dialog] Add an indicator to the photo button as well



commit 48efd3341f364b2f7abedc5c6aa6d0dd81e10cad
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 1 13:52:34 2010 -0500

    Add an indicator to the photo button as well

 data/user-accounts-dialog.ui |    1 +
 src/um-photo-dialog.c        |   39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/data/user-accounts-dialog.ui b/data/user-accounts-dialog.ui
index 08bba91..409b718 100644
--- a/data/user-accounts-dialog.ui
+++ b/data/user-accounts-dialog.ui
@@ -624,6 +624,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="relief">none</property>
                                     <child>
                                       <object class="GtkImage" id="user-icon-image2">
                                         <property name="visible">True</property>
diff --git a/src/um-photo-dialog.c b/src/um-photo-dialog.c
index c95b520..40ff3ec 100644
--- a/src/um-photo-dialog.c
+++ b/src/um-photo-dialog.c
@@ -496,6 +496,38 @@ on_photo_popup_unmap (GtkWidget     *popup_menu,
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (um->popup_button), FALSE);
 }
 
+static void
+popup_button_expose (GtkWidget      *widget,
+                     GdkEventExpose *event,
+                     UmPhotoDialog  *um)
+{
+        GtkAllocation allocation;
+
+        if (gtk_widget_get_state (widget) != GTK_STATE_PRELIGHT &&
+            !gtk_widget_is_focus (gtk_widget_get_parent (widget))) {
+                return;
+        }
+
+        gtk_widget_get_allocation (widget, &allocation);
+        gtk_paint_expander (gtk_widget_get_style (widget),
+                            gtk_widget_get_window (widget),
+                            gtk_widget_get_state (widget),
+                            NULL,
+                            widget,
+                            NULL,
+                            allocation.x + allocation.width,
+                            allocation.y + allocation.height,
+                            GTK_EXPANDER_EXPANDED);
+}
+
+static void
+popup_button_focus_changed (GObject       *button,
+                            GParamSpec    *pspec,
+                            UmPhotoDialog *um)
+{
+        gtk_widget_queue_draw (gtk_bin_get_child (GTK_BIN (button)));
+}
+
 UmPhotoDialog *
 um_photo_dialog_new (GtkWidget *button, GtkWidget *parent)
 {
@@ -510,8 +542,13 @@ um_photo_dialog_new (GtkWidget *button, GtkWidget *parent)
         setup_photo_popup (um);
         g_signal_connect (button, "toggled",
                           G_CALLBACK (popup_icon_menu), um);
-        g_signal_connect (G_OBJECT (um->popup_button), "button-press-event",
+        g_signal_connect (button, "button-press-event",
                           G_CALLBACK (on_popup_button_button_pressed), um);
+        g_signal_connect (button, "notify::is-focus",
+                          G_CALLBACK (popup_button_focus_changed), um);
+        g_signal_connect_after (gtk_bin_get_child (GTK_BIN (button)), "expose-event",
+                                G_CALLBACK (popup_button_expose), um);
+
         g_signal_connect (um->photo_popup, "unmap",
                           G_CALLBACK (on_photo_popup_unmap), um);
 



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