This is an automated email from the git hooks/post-receive script. b l u e s a b r e 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 apps/xfce4-screensaver.
commit a1500bd3b993005ad696bfbda2fc7af8b69598f0 Author: Sean Davis <smd.seanda...@gmail.com> Date: Sun Oct 7 13:31:08 2018 -0400 Restore the panel --- data/lock-dialog-default.ui | 347 +++++++++++++++++++++++------------------ src/Makefile.am | 2 + src/gs-lock-plug.c | 140 +++++++++++------ src/gs-window-x11.c | 5 +- src/xfce-bg.c | 39 ++++- src/xfce-bg.h | 6 + src/xfce4-screensaver-dialog.c | 44 ++++-- 7 files changed, 357 insertions(+), 226 deletions(-) diff --git a/data/lock-dialog-default.ui b/data/lock-dialog-default.ui index 5cff1fe..58300fe 100644 --- a/data/lock-dialog-default.ui +++ b/data/lock-dialog-default.ui @@ -14,183 +14,176 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkBox" id="vbox4"> - <property name="name">content_frame</property> + <object class="GtkBox" id="content-area"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">18</property> <property name="margin_right">18</property> - <property name="margin_top">12</property> - <property name="spacing">6</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkLabel" id="auth-date-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">%s</property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="auth-time-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">%s</property> - <property name="use_markup">True</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="auth-face-image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">end</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="vbox3"> - <property name="name">content_frame</property> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="margin_top">18</property> <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="auth-realname-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label"><span size="x-large">%R</span></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="auth-username-label"> + <object class="GtkBox" id="user-box"> + <property name="name">content_frame</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label"><span size="small">%U on %h</span></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="status-message-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="wrap">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkBox" id="auth-prompt-box"> - <property name="name">content_frame</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="auth-prompt-label"> - <property name="can_focus">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> + <property name="spacing">12</property> + <child> + <object class="GtkImage" id="auth-face-image"> + <property name="name">user_image</property> + <property name="width_request">80</property> + <property name="height_request">80</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="pixel_size">80</property> + <property name="icon_name">avatar-default</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="auth-realname-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">%U</property> + <property name="label"><span size="x-large">%R</span></property> + <property name="use_markup">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="auth-prompt-entry"> + <property name="can_focus">True</property> + <property name="visibility">False</property> + <property name="activates_default">True</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="placeholder_text" translatable="yes">Enter your password</property> + <property name="input_purpose">password</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="auth-prompt-kbd-layout-indicator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox" id="hbox1"> + <object class="GtkBox" id="auth-prompt-box"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> + <property name="orientation">vertical</property> <child> - <object class="GtkEntry" id="auth-prompt-entry"> - <property name="can_focus">True</property> - <property name="margin_left">18</property> - <property name="margin_right">18</property> - <property name="visibility">False</property> - <property name="activates_default">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="placeholder_text" translatable="yes">Enter your password</property> - <property name="input_purpose">password</property> + <object class="GtkLabel" id="status-message-label"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">1</property> + <property name="wrap">True</property> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="auth-prompt-label"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">2</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkBox" id="auth-prompt-kbd-layout-indicator"> - <property name="visible">True</property> + <object class="GtkLabel" id="auth-capslock-label"> <property name="can_focus">False</property> - <child> - <placeholder/> - </child> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">You have the Caps Lock key on.</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">2</property> </packing> </child> + <child> + <object class="GtkLabel" id="auth-status-label"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">3</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="auth-capslock-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> <property name="position">2</property> </packing> </child> @@ -198,22 +191,11 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="auth-status-label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">5</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkBox" id="action-buttons"> <property name="name">buttonbox_frame</property> <property name="visible">True</property> <property name="can_focus">False</property> @@ -224,8 +206,7 @@ <property name="can_focus">False</property> <property name="margin_left">12</property> <property name="margin_right">12</property> - <property name="margin_top">6</property> - <property name="margin_bottom">24</property> + <property name="margin_bottom">12</property> <property name="spacing">6</property> <property name="layout_style">end</property> <child> @@ -317,4 +298,60 @@ <class name="lightdm-gtk-greeter"/> </style> </object> + <object class="GtkOverlay" id="lock-overlay"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkImage" id="lock-image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-missing-image</property> + </object> + <packing> + <property name="index">-1</property> + </packing> + </child> + </object> + <object class="GtkBox" id="lock-panel"> + <property name="name">panel_window</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="auth-hostname-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">6</property> + <property name="label" translatable="yes">%h</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkLabel" id="auth-date-time-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="label" translatable="yes">%s</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <style> + <class name="background"/> + </style> + </object> </interface> diff --git a/src/Makefile.am b/src/Makefile.am index a23ed54..939d6f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -154,6 +154,8 @@ xfce4_screensaver_dialog_SOURCES = \ xfcekbd-desktop-config.h \ xfcekbd-keyboard-config.c \ xfcekbd-keyboard-config.h \ + xfce-bg.c \ + xfce-bg.h \ desktop-entries.c \ desktop-entries.h \ menu-layout.c \ diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c index 40627ed..5f6fb82 100644 --- a/src/gs-lock-plug.c +++ b/src/gs-lock-plug.c @@ -49,6 +49,7 @@ #include "gs-lock-plug.h" #include "gs-debug.h" +#include "xfce-bg.h" #define GSETTINGS_SCHEMA "org.xfce.screensaver" @@ -78,8 +79,7 @@ struct GSLockPlugPrivate GtkWidget *auth_action_area; GtkWidget *auth_face_image; - GtkWidget *auth_time_label; - GtkWidget *auth_date_label; + GtkWidget *auth_datetime_label; GtkWidget *auth_realname_label; GtkWidget *auth_username_label; GtkWidget *auth_prompt_label; @@ -271,6 +271,11 @@ set_status_text (GSLockPlug *plug, if (plug->priv->auth_message_label != NULL) { gtk_label_set_text (GTK_LABEL (plug->priv->auth_message_label), text); + if (g_utf8_strlen (text, 1) == 0) { + gtk_widget_hide (GTK_WIDGET (plug->priv->auth_message_label)); + } else { + gtk_widget_show (GTK_WIDGET (plug->priv->auth_message_label)); + } } } @@ -278,27 +283,18 @@ static void date_time_update (GSLockPlug *plug) { GDateTime *datetime; - gchar *time; + gchar *datetime_format; gchar *date; gchar *str; datetime = g_date_time_new_now_local (); - time = g_date_time_format (datetime, "%X"); - /* Translators: Date format, see https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format */ - date = g_date_time_format (datetime, _("%A, %B %e")); - - str = g_strdup_printf ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>", time); - gtk_label_set_text (GTK_LABEL (plug->priv->auth_time_label), str); - gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_time_label), TRUE); - g_free (str); + datetime_format = g_date_time_format (datetime, _("%A, %B %e %X")); - str = g_strdup_printf ("<span size=\"large\">%s</span>", date); - gtk_label_set_markup (GTK_LABEL (plug->priv->auth_date_label), str); - gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_date_label), TRUE); + str = g_strdup_printf ("%s", datetime_format); + gtk_label_set_text (GTK_LABEL (plug->priv->auth_datetime_label), str); g_free (str); - g_free (time); - g_free (date); + g_free (datetime_format); g_date_time_unref (datetime); } @@ -417,13 +413,11 @@ capslock_update (GSLockPlug *plug, if (is_on) { - gtk_label_set_text (GTK_LABEL (plug->priv->auth_capslock_label), - _("You have the Caps Lock key on.")); + gtk_widget_show (GTK_WIDGET (plug->priv->auth_capslock_label)); } else { - gtk_label_set_text (GTK_LABEL (plug->priv->auth_capslock_label), - ""); + gtk_widget_hide (GTK_WIDGET (plug->priv->auth_capslock_label)); } } @@ -1413,8 +1407,14 @@ gs_lock_plug_enable_prompt (GSLockPlug *plug, gtk_widget_set_sensitive (plug->priv->auth_unlock_button, TRUE); gtk_widget_show (plug->priv->auth_unlock_button); gtk_widget_grab_default (plug->priv->auth_unlock_button); - gtk_label_set_text (GTK_LABEL (plug->priv->auth_prompt_label), message); - gtk_widget_show (plug->priv->auth_prompt_label); + + gtk_label_set_text(GTK_LABEL(plug->priv->auth_prompt_label), message); + if (g_utf8_strlen(message, -1) == 0) { + gtk_widget_hide (GTK_WIDGET (plug->priv->auth_prompt_label)); + } else { + gtk_widget_show (GTK_WIDGET (plug->priv->auth_prompt_label)); + } + gtk_entry_set_visibility (GTK_ENTRY (plug->priv->auth_prompt_entry), visible); gtk_widget_set_sensitive (plug->priv->auth_prompt_entry, TRUE); gtk_widget_show (plug->priv->auth_prompt_entry); @@ -1754,22 +1754,6 @@ create_page_one (GSLockPlug *plug) vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0); - str = g_strdup ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>"); - plug->priv->auth_time_label = gtk_label_new (str); - g_free (str); - gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_time_label), 0.5); - gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_time_label), 0.5); - gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_time_label), TRUE); - gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_time_label, FALSE, FALSE, 0); - - str = g_strdup ("<span size=\"large\">%s</span>"); - plug->priv->auth_date_label = gtk_label_new (str); - g_free (str); - gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_date_label), 0.5); - gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_date_label), 0.5); - gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_date_label), TRUE); - gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_date_label, FALSE, FALSE, 0); - plug->priv->auth_face_image = gtk_image_new (); gtk_box_pack_start (GTK_BOX (vbox), plug->priv->auth_face_image, TRUE, TRUE, 0); gtk_widget_set_halign (plug->priv->auth_face_image, GTK_ALIGN_CENTER); @@ -1803,7 +1787,7 @@ create_page_one (GSLockPlug *plug) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - plug->priv->auth_prompt_label = gtk_label_new_with_mnemonic (_("_Password:")); + plug->priv->auth_prompt_label = gtk_label_new (_("Please enter your password.")); gtk_box_pack_start (GTK_BOX (hbox), plug->priv->auth_prompt_label, FALSE, FALSE, 0); plug->priv->auth_prompt_entry = gtk_entry_new (); @@ -1812,11 +1796,6 @@ create_page_one (GSLockPlug *plug) gtk_label_set_mnemonic_widget (GTK_LABEL (plug->priv->auth_prompt_label), plug->priv->auth_prompt_entry); - plug->priv->auth_capslock_label = gtk_label_new (""); - gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5); - gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5); - gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_capslock_label, FALSE, FALSE, 0); - /* Status text */ plug->priv->auth_message_label = gtk_label_new (NULL); @@ -1881,6 +1860,44 @@ get_dialog_theme_name (GSLockPlug *plug) return name; } +static void +get_draw_dimensions(GSLockPlug *plug, + XfceBG *bg, + gint *screen_width, + gint *screen_height, + gint *monitor_width, + gint *monitor_height) +{ + GdkWindow *window; + GdkDisplay *display; + GdkScreen *screen; + GdkMonitor *monitor; + GdkRectangle geometry; + gint scale; + + window = gtk_widget_get_window (GTK_WIDGET(plug)); + if (window != NULL) { + display = gdk_window_get_display(window); + } else { + display = gdk_display_get_default(); + } + screen = gdk_display_get_default_screen(display); + scale = gdk_window_get_scale_factor(gdk_screen_get_root_window(screen)); + if (window != NULL) { + monitor = gdk_display_get_monitor_at_window(display, window); + } else { + monitor = gdk_display_get_primary_monitor (display); + } + + xfce_bg_load_from_preferences(bg, monitor); + + gdk_monitor_get_geometry(monitor, &geometry); + *monitor_width = geometry.width / scale; + *monitor_height = geometry.height / scale; + *screen_width = WidthOfScreen(gdk_x11_screen_get_xscreen(screen)) / scale; + *screen_height = HeightOfScreen(gdk_x11_screen_get_xscreen(screen)) / scale; +} + static gboolean load_theme (GSLockPlug *plug) { @@ -1889,9 +1906,16 @@ load_theme (GSLockPlug *plug) char *gtkbuilder; char *css; GtkBuilder *builder; + GtkWidget *lock_overlay; + GtkWidget *lock_panel; GtkWidget *lock_dialog; + GtkWidget *bg_image; GError *error=NULL; + XfceBG *bg; + GdkPixbuf *pixbuf; + gint screen_width, screen_height, monitor_width, monitor_height; + theme = get_dialog_theme_name (plug); if (theme == NULL) { @@ -1930,17 +1954,34 @@ load_theme (GSLockPlug *plug) } g_free (gtkbuilder); - lock_dialog = GTK_WIDGET (gtk_builder_get_object(builder, "lock-dialog")); - gtk_container_add (GTK_CONTAINER (plug), lock_dialog); + bg_image = GTK_WIDGET (gtk_builder_get_object(builder, "lock-image")); + + bg = xfce_bg_new(); + get_draw_dimensions(plug, bg, &screen_width, &screen_height, &monitor_width, &monitor_height); + pixbuf = xfce_bg_get_pixbuf(bg, screen_width, screen_height, monitor_width, monitor_height); + gtk_image_set_from_pixbuf (GTK_IMAGE(bg_image), pixbuf); + + lock_overlay = GTK_WIDGET(gtk_builder_get_object(builder, "lock-overlay")); + lock_panel = GTK_WIDGET(gtk_builder_get_object(builder, "lock-panel")); + lock_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "lock-dialog")); + + gtk_widget_set_halign(GTK_WIDGET(lock_panel), GTK_ALIGN_FILL); + gtk_widget_set_valign(GTK_WIDGET(lock_panel), GTK_ALIGN_START); + gtk_overlay_add_overlay(GTK_OVERLAY(lock_overlay), GTK_WIDGET(lock_panel)); + + gtk_widget_set_halign(GTK_WIDGET(lock_dialog), GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(lock_dialog), GTK_ALIGN_CENTER); + gtk_overlay_add_overlay(GTK_OVERLAY(lock_overlay), GTK_WIDGET(lock_dialog)); + + gtk_container_add(GTK_CONTAINER(plug), lock_overlay); plug->priv->vbox = NULL; plug->priv->auth_face_image = GTK_WIDGET (gtk_builder_get_object(builder, "auth-face-image")); plug->priv->auth_action_area = GTK_WIDGET (gtk_builder_get_object(builder, "auth-action-area")); - plug->priv->auth_time_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-time-label")); - plug->priv->auth_date_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-date-label")); + plug->priv->auth_datetime_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-date-time-label")); plug->priv->auth_realname_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-realname-label")); - plug->priv->auth_username_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-username-label")); + plug->priv->auth_username_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-hostname-label")); plug->priv->auth_prompt_label = GTK_WIDGET (gtk_builder_get_object(builder, "auth-prompt-label")); plug->priv->auth_prompt_entry = GTK_WIDGET (gtk_builder_get_object(builder, "auth-prompt-entry")); plug->priv->auth_prompt_box = GTK_WIDGET (gtk_builder_get_object(builder, "auth-prompt-box")); @@ -2096,6 +2137,7 @@ gs_lock_plug_init (GSLockPlug *plug) { gtk_label_set_text (GTK_LABEL (plug->priv->status_message_label), plug->priv->status_message); + gtk_widget_show (plug->priv->status_message_label); } else { diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c index 46731e2..bc9c333 100644 --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -1695,7 +1695,10 @@ popup_dialog (GSWindow *window) command = g_string_new (tmp); g_free (tmp); - if (is_logout_enabled (window)) + g_string_append_printf(command, " --height='%i'", window->priv->geometry.height); + g_string_append_printf(command, " --width='%i'", window->priv->geometry.width); + + if (is_logout_enabled(window)) { command = g_string_append (command, " --enable-logout"); g_string_append_printf (command, " --logout-command='%s'", window->priv->logout_command); diff --git a/src/xfce-bg.c b/src/xfce-bg.c index 77ce925..e34ebff 100644 --- a/src/xfce-bg.c +++ b/src/xfce-bg.c @@ -909,8 +909,7 @@ draw_once (XfceBG *bg, static void xfce_bg_draw (XfceBG *bg, - GdkPixbuf *dest, - GdkScreen *screen) + GdkPixbuf *dest) { if (!bg) return; @@ -981,6 +980,36 @@ xfce_bg_create_surface (XfceBG *bg, 1); } +GdkPixbuf * +xfce_bg_get_pixbuf(XfceBG *bg, + int screen_width, + int screen_height, + int monitor_width, + int monitor_height) +{ + GdkPixbuf *pixbuf; + gint width; + gint height; + + if (bg->placement == XFCE_BG_PLACEMENT_SPANNED) + { + width = screen_width; + height = screen_height; + } + else + { + width = monitor_width; + height = monitor_height; + } + + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, + width, height); + + xfce_bg_draw(bg, pixbuf); + + return pixbuf; +} + /** * xfce_bg_create_surface: * @bg: XfceBG @@ -1038,11 +1067,7 @@ xfce_bg_create_surface_scale (XfceBG *bg, } else { - GdkPixbuf *pixbuf; - - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, - width, height); - xfce_bg_draw (bg, pixbuf, gdk_window_get_screen (window)); + GdkPixbuf *pixbuf = xfce_bg_get_pixbuf(bg, screen_width, screen_height, monitor_width, monitor_height); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); g_object_unref (pixbuf); } diff --git a/src/xfce-bg.h b/src/xfce-bg.h index 435e122..c8321d6 100644 --- a/src/xfce-bg.h +++ b/src/xfce-bg.h @@ -89,6 +89,12 @@ cairo_surface_t *xfce_bg_create_surface (XfceBG *bg, int monitor_width, int monitor_height); +GdkPixbuf *xfce_bg_get_pixbuf(XfceBG *bg, + int screen_width, + int screen_height, + int monitor_width, + int monitor_height); + G_END_DECLS #endif diff --git a/src/xfce4-screensaver-dialog.c b/src/xfce4-screensaver-dialog.c index 686ea62..f464628 100644 --- a/src/xfce4-screensaver-dialog.c +++ b/src/xfce4-screensaver-dialog.c @@ -43,12 +43,16 @@ #include "gs-debug.h" +#include <xfconf/xfconf.h> + #define MAX_FAILURES 5 static gboolean verbose = FALSE; static gboolean show_version = FALSE; static gboolean enable_logout = FALSE; static gboolean enable_switch = FALSE; +static gint dialog_height = 0; +static gint dialog_width = 0; static char* logout_command = NULL; static char* status_message = NULL; static char* away_message = NULL; @@ -61,6 +65,8 @@ static GOptionEntry entries[] = { {"enable-switch", 0, 0, G_OPTION_ARG_NONE, &enable_switch, N_("Show the switch user button"), NULL}, {"status-message", 0, 0, G_OPTION_ARG_STRING, &status_message, N_("Message to show in the dialog"), N_("MESSAGE")}, {"away-message", 0, 0, G_OPTION_ARG_STRING, &away_message, N_("Not used"), N_("MESSAGE")}, + {"height", 0, 0, G_OPTION_ARG_INT, &dialog_height, N_("Monitor height"), NULL}, + {"width", 0, 0, G_OPTION_ARG_INT, &dialog_width, N_("Monitor width"), NULL}, {NULL} }; @@ -162,25 +168,25 @@ static const char* maybe_translate_message(const char* msg) some of these messages to be more sane. */ hash = g_hash_table_new (g_str_hash, g_str_equal); /* login: is whacked always translate to Username: */ - g_hash_table_insert(hash, "login:", _("Username:")); - g_hash_table_insert(hash, "Username:", _("Username:")); - g_hash_table_insert(hash, "username:", _("Username:")); - g_hash_table_insert(hash, "Password:", _("Password:")); - g_hash_table_insert(hash, "password:", _("Password:")); + g_hash_table_insert(hash, "login:", _("Please enter your username.")); + g_hash_table_insert(hash, "Username:", _("Please enter your username.")); + g_hash_table_insert(hash, "username:", _("Please enter your username.")); + g_hash_table_insert(hash, "Password:", ""); + g_hash_table_insert(hash, "password:", ""); g_hash_table_insert(hash, "You are required to change your password immediately (password aged)", _("You are required to change your password immediately (password aged)")); g_hash_table_insert(hash, "You are required to change your password immediately (root enforced)", _("You are required to change your password immediately (root enforced)")); g_hash_table_insert(hash, "Your account has expired; please contact your system administrator", _("Your account has expired; please contact your system administrator")); - g_hash_table_insert(hash, "No password supplied", _("No password supplied")); - g_hash_table_insert(hash, "Password unchanged", _("Password unchanged")); - g_hash_table_insert(hash, "Can not get username", _("Can not get username")); - g_hash_table_insert(hash, "Retype new UNIX password:", _("Retype new UNIX password:")); - g_hash_table_insert(hash, "Enter new UNIX password:", _("Enter new UNIX password:")); - g_hash_table_insert(hash, "(current) UNIX password:", _("(current) UNIX password:")); + g_hash_table_insert(hash, "No password supplied", _("No password supplied.")); + g_hash_table_insert(hash, "Password unchanged", _("Password unchanged.")); + g_hash_table_insert(hash, "Can not get username", _("Can not get username.")); + g_hash_table_insert(hash, "Retype new UNIX password:", _("Retype your new password.")); + g_hash_table_insert(hash, "Enter new UNIX password:", _("Enter your new password.")); + g_hash_table_insert(hash, "(current) UNIX password:", _("Enter your current password:")); g_hash_table_insert(hash, "Error while changing NIS password.", _("Error while changing NIS password.")); - g_hash_table_insert(hash, "You must choose a longer password", _("You must choose a longer password")); + g_hash_table_insert(hash, "You must choose a longer password", _("You must choose a longer password.")); g_hash_table_insert(hash, "Password has been already used. Choose another.", _("Password has been already used. Choose another.")); - g_hash_table_insert(hash, "You must wait longer to change your password", _("You must wait longer to change your password")); - g_hash_table_insert(hash, "Sorry, passwords do not match", _("Sorry, passwords do not match")); + g_hash_table_insert(hash, "You must wait longer to change your password", _("You must wait longer to change your password.")); + g_hash_table_insert(hash, "Sorry, passwords do not match", _("Sorry, passwords do not match.")); /* FIXME: what about messages which have some variables in them, perhaps try to do those as well */ } @@ -404,6 +410,8 @@ static gboolean popup_dialog_idle(void) g_object_set(widget, "status-message", status_message, NULL); } + gtk_widget_set_size_request(widget, dialog_width, dialog_height); + g_signal_connect(GS_LOCK_PLUG(widget), "response", G_CALLBACK(response_cb), NULL); g_signal_connect(widget, "show", G_CALLBACK(show_cb), NULL); @@ -575,6 +583,14 @@ int main(int argc, char** argv) exit(1); } + if (!xfconf_init(&error)) + { + g_error("Failed to connect to xfconf daemon: %s.", error->message); + g_error_free(error); + + exit(1); + } + if (show_version) { g_print("%s %s\n", argv[0], VERSION); -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits