[Xfce4-commits] [xfce/xfce4-session] 02/03: Improve look and feel of the session chooser

noreply at xfce.org noreply at xfce.org
Sat Apr 27 00:37:36 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-session.

commit ece82f353415e3436d0f1eca5d5a296bb1ccbce4
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Apr 26 23:38:13 2019 +0200

    Improve look and feel of the session chooser
    
    Also: add xfsm-session-chooser css class for styling the chooser
---
 xfce4-session/xfsm-chooser.c | 17 +++++++++++++++--
 xfce4-session/xfsm-manager.c | 16 +++++++++++-----
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/xfce4-session/xfsm-chooser.c b/xfce4-session/xfsm-chooser.c
index 82bab8f..e3e02b2 100644
--- a/xfce4-session/xfsm-chooser.c
+++ b/xfce4-session/xfsm-chooser.c
@@ -148,6 +148,7 @@ xfsm_chooser_init (XfsmChooser *chooser)
   GtkWidget *vbox;
   GtkWidget *label;
   GtkWidget *dbox;
+  gchar title[256];
 
   dbox = gtk_dialog_get_content_area(GTK_DIALOG (chooser));
 
@@ -157,7 +158,10 @@ xfsm_chooser_init (XfsmChooser *chooser)
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_widget_set_margin_bottom (vbox, 6);
   gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0);
-  label = gtk_label_new (_("Choose session"));
+  g_snprintf (title, 256, "<big><b>%s</b></big>",
+              _("Choose a session"));
+  label = gtk_label_new (title);
+  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
   gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
 
   /* scrolled window */
@@ -217,11 +221,20 @@ xfsm_chooser_init (XfsmChooser *chooser)
   gtk_widget_show (button);
 
   /* "New" button */
-  button = xfce_gtk_button_new_mixed ("document-new", _("New session"));
+  button = xfce_gtk_button_new_mixed ("document-new", _("Create new session"));
   gtk_widget_set_tooltip_text (button, _("Create a new session."));
   gtk_dialog_add_action_widget (GTK_DIALOG (chooser), button,
                                 XFSM_RESPONSE_NEW);
   gtk_widget_show (button);
+
+  /* "Start" button */
+  button = xfce_gtk_button_new_mixed ("", _("Start"));
+  gtk_widget_set_tooltip_text (button, _("Start an existing session."));
+  gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
+  gtk_dialog_set_default_response (GTK_DIALOG (chooser), XFSM_RESPONSE_LOAD);
+  gtk_dialog_add_action_widget (GTK_DIALOG (chooser), button,
+                                XFSM_RESPONSE_LOAD);
+  gtk_widget_show (button);
 }
 
 
diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c
index e847eea..10936a6 100644
--- a/xfce4-session/xfsm-manager.c
+++ b/xfce4-session/xfsm-manager.c
@@ -676,11 +676,12 @@ again:
       chooser = g_object_new (XFSM_TYPE_CHOOSER,
                               "type", GTK_WINDOW_POPUP,
                               NULL);
-      xfsm_window_add_border (GTK_WINDOW (chooser));
+      gtk_container_set_border_width (GTK_CONTAINER (chooser), 6);
       xfsm_chooser_set_sessions (XFSM_CHOOSER (chooser),
                                  sessions, default_session);
       gtk_window_set_screen (GTK_WINDOW (chooser), screen);
       gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_CENTER);
+      gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (chooser)), "xfsm-session-chooser");
       result = gtk_dialog_run (GTK_DIALOG (chooser));
 
       if (result == XFSM_RESPONSE_LOAD)
@@ -702,6 +703,7 @@ again:
 
       if (result == XFSM_CHOOSE_NEW)
         {
+          GtkWidget *button;
           dialog = gtk_dialog_new_with_buttons (NULL,
                                                 NULL,
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -714,21 +716,25 @@ again:
                                            GTK_RESPONSE_OK);
           gtk_window_set_screen (GTK_WINDOW (dialog), screen);
           gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-          g_snprintf (title, 256, "<big>%s</big>",
-                      _("Choose a name for the new session:"));
+          gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
+          gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (dialog)), "xfsm-session-chooser");
+          g_snprintf (title, 256, "<big><b>%s</b></big>",
+                      _("Name for the new session"));
           label = gtk_label_new (title);
           gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
           gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                               label, TRUE, TRUE, 6);
           gtk_widget_show (label);
 
+          button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
+                                                       GTK_RESPONSE_OK);
+          gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
+
           entry = gtk_entry_new ();
           gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                               entry, TRUE, TRUE, 6);
           gtk_widget_show (entry);
 
-          xfsm_window_add_border (GTK_WINDOW (dialog));
-
 again1:
           result = gtk_dialog_run (GTK_DIALOG (dialog));
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list