[gnome-system-tools/users-ui-redesign: 8/12] Move Real name and profile out of the notebook and show the face



commit c8251b93c99700648024df34dbad977521a9c4c0
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Fri Aug 7 00:00:31 2009 +0200

    Move Real name and profile out of the notebook and show the face
    
    This requires moving get_user_face() to user-settings.c to avoid duplication, and change its prototype.

 interfaces/users.ui       |  297 +++++++++++++++++++++------------------------
 src/users/user-settings.c |   25 ++++
 src/users/user-settings.h |    1 +
 src/users/users-table.c   |   22 +---
 4 files changed, 168 insertions(+), 177 deletions(-)
---
diff --git a/interfaces/users.ui b/interfaces/users.ui
index 7cd8944..c66617a 100644
--- a/interfaces/users.ui
+++ b/interfaces/users.ui
@@ -183,6 +183,75 @@
               </packing>
             </child>
             <child>
+              <object class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="n_rows">2</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">12</property>
+                <child>
+                  <object class="GtkImage" id="user_settings_face">
+                    <property name="width_request">60</property>
+                    <property name="height_request">60</property>
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="pixel_size">60</property>
+                    <property name="icon_name">stock_person</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="user_settings_real_name">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">&#x25CF;</property>
+                    <property name="activates_default">True</property>
+                    <property name="text" translatable="yes">s</property>
+                    <property name="shadow_type">none</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="user_settings_profile_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Account _type:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">user_settings_profile_menu</property>
+                    <attributes>
+                      <attribute name="weight" value="normal"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="user_settings_profile_menu">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="padding">6</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkNotebook" id="user_settings_notebook">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -194,142 +263,9 @@
                     <property name="orientation">vertical</property>
                     <property name="spacing">18</property>
                     <child>
-                      <object class="GtkTable" id="table47">
-                        <property name="visible">True</property>
-                        <property name="n_rows">4</property>
-                        <property name="n_columns">3</property>
-                        <property name="column_spacing">12</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="label227">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">&lt;span weight="bold"&gt;Basic Settings&lt;/span&gt;</property>
-                            <property name="use_markup">True</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label229">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Username:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">user_settings_name</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label230">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Real name:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">user_settings_real_name</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="user_settings_name">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="invisible_char">&#x25CF;</property>
-                            <property name="activates_default">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="user_settings_real_name">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="invisible_char">&#x25CF;</property>
-                            <property name="activates_default">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label228">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="user_settings_profile_label">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Profile:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">user_settings_profile_menu</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkComboBox" id="user_settings_profile_menu">
-                            <property name="visible">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkTable" id="table50">
                         <property name="visible">True</property>
-                        <property name="n_rows">8</property>
+                        <property name="n_rows">9</property>
                         <property name="n_columns">4</property>
                         <property name="column_spacing">12</property>
                         <property name="row_spacing">6</property>
@@ -342,6 +278,8 @@
                           </object>
                           <packing>
                             <property name="right_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -357,8 +295,8 @@
                           <packing>
                             <property name="left_attach">2</property>
                             <property name="right_attach">3</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -374,8 +312,8 @@
                           <packing>
                             <property name="left_attach">3</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
@@ -390,8 +328,8 @@
                           <packing>
                             <property name="left_attach">3</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
@@ -404,8 +342,8 @@
                           <packing>
                             <property name="left_attach">2</property>
                             <property name="right_attach">3</property>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
+                            <property name="top_attach">7</property>
+                            <property name="bottom_attach">8</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -479,8 +417,8 @@
                           <packing>
                             <property name="left_attach">3</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
+                            <property name="top_attach">7</property>
+                            <property name="bottom_attach">8</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options">GTK_FILL</property>
                           </packing>
@@ -491,8 +429,8 @@
                             <property name="xalign">0</property>
                           </object>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">7</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">8</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -505,8 +443,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">7</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">8</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -524,8 +462,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">7</property>
-                            <property name="bottom_attach">8</property>
+                            <property name="top_attach">8</property>
+                            <property name="bottom_attach">9</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -543,8 +481,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -561,8 +499,8 @@
                           <packing>
                             <property name="left_attach">2</property>
                             <property name="right_attach">3</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -578,8 +516,8 @@
                           <packing>
                             <property name="left_attach">2</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -597,8 +535,47 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">4</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label229">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Username:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">user_settings_name</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="user_settings_name">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">&#x25CF;</property>
+                            <property name="activates_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="right_attach">4</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label228">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
@@ -610,7 +587,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">1</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                   </object>
@@ -1149,7 +1126,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index 6e2b57c..8492080 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -417,6 +417,25 @@ setup_profiles_visibility (GstTool  *tool,
 	g_list_free (names);
 }
 
+GdkPixbuf *
+user_settings_get_user_face (OobsUser *user, int size)
+{
+	GdkPixbuf *pixbuf;
+	const gchar *homedir;
+	gchar *face_path;
+
+	homedir = oobs_user_get_home_directory (user);
+	face_path = g_strdup_printf ("%s/.face", homedir);
+	pixbuf = gdk_pixbuf_new_from_file_at_size (face_path, size, size, NULL);
+
+	if (!pixbuf)
+		pixbuf = gtk_icon_theme_load_icon (tool->icon_theme, "stock_person", size, 0, NULL);
+
+	g_free (face_path);
+
+	return pixbuf;
+}
+
 void
 user_settings_set (OobsUser *user)
 {
@@ -426,6 +445,7 @@ user_settings_set (OobsUser *user)
 	const gchar *login = NULL;
 	gchar *title;
 	gint uid;
+	GdkPixbuf *face;
 
 	notice = gst_dialog_get_widget (tool->main_dialog, "user_settings_uid_disabled");
 
@@ -485,6 +505,11 @@ user_settings_set (OobsUser *user)
 	widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_real_name");
 	set_entry_text (widget, (user) ? oobs_user_get_full_name (user) : NULL);
 
+	widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_face");
+	face = user_settings_get_user_face (user, 60);
+	gtk_image_set_from_pixbuf (GTK_IMAGE (widget), face);
+	g_object_unref (face);
+
 	widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_room_number");
 	set_entry_text (widget, (user) ? oobs_user_get_room_number (user) : NULL);
 
diff --git a/src/users/user-settings.h b/src/users/user-settings.h
index d0d7ef2..c32c775 100644
--- a/src/users/user-settings.h
+++ b/src/users/user-settings.h
@@ -33,6 +33,7 @@ gint            user_settings_dialog_run         (GtkWidget *dialog);
 
 OobsUser *      user_settings_dialog_get_data    (GtkWidget *dialog);
 void            user_settings_apply_profile      (GstUsersTool *tool, GstUserProfile *profile);
+GdkPixbuf *     user_settings_get_user_face      (OobsUser *user, int size);
 
 
 #endif /* USER_SETTINGS_H */
diff --git a/src/users/users-table.c b/src/users/users-table.c
index f2ed5a3..d1e1fca 100644
--- a/src/users/users-table.c
+++ b/src/users/users-table.c
@@ -27,6 +27,7 @@
 
 #include "table.h"
 #include "users-table.h"
+#include "user-settings.h"
 #include "callbacks.h"
 
 extern GstTool *tool;
@@ -137,22 +138,6 @@ create_users_table (GstUsersTool *tool)
 			  G_CALLBACK (on_table_popup_menu), NULL);
 }
 
-static GdkPixbuf*
-get_user_face (const gchar *homedir)
-{
-	gchar *face_path = g_strdup_printf ("%s/.face", homedir);
-	GdkPixbuf *pixbuf;
-
-	pixbuf = gdk_pixbuf_new_from_file_at_size (face_path, 48, 48, NULL);
-
-	if (!pixbuf)
-		pixbuf = gtk_icon_theme_load_icon (tool->icon_theme, "stock_person", 48, 0, NULL);
-
-	g_free (face_path);
-
-	return pixbuf;
-}
-
 void
 users_table_set_user (OobsUser *user, OobsListIter *list_iter, GtkTreeIter *iter)
 {
@@ -164,11 +149,14 @@ users_table_set_user (OobsUser *user, OobsListIter *list_iter, GtkTreeIter *iter
 	const char *name;
 	const char *login;
 	char *label;
+	gboolean sensitive;
 
-	face = get_user_face (oobs_user_get_home_directory (user));
+	face = user_settings_get_user_face (user, 48);
 	name = oobs_user_get_full_name (user);
 	login = oobs_user_get_login_name (user);
 	label = g_strdup_printf ("<big><b>%s</b>\n<span color=\'dark grey\'><i>%s</i></span></big>", name, login);
+	sensitive = gst_dialog_is_authenticated (tool->main_dialog) ||
+	            (user == oobs_self_config_get_user (OOBS_SELF_CONFIG (object)));
 
 	gtk_list_store_set (GTK_LIST_STORE (model), iter,
 			    COL_USER_FACE, face,



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