gnome-session r4783 - in branches/dbus_based: . gnome-session
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r4783 - in branches/dbus_based: . gnome-session
- Date: Thu, 26 Jun 2008 00:18:53 +0000 (UTC)
Author: mccann
Date: Thu Jun 26 00:18:53 2008
New Revision: 4783
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4783&view=rev
Log:
2008-06-25 William Jon McCann <jmccann redhat com>
* gnome-session/gsm-logout-inhibit-dialog.c (model_has_one_entry),
(update_dialog_text), (on_store_inhibitor_added),
(on_store_inhibitor_removed), (populate_model):
* gnome-session/gsm-logout-inhibit-dialog.glade:
Use the proper pluralization depending on how many inhibitors are present.
Fix up spacing.
Modified:
branches/dbus_based/ChangeLog
branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade
Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c (original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c Thu Jun 26 00:18:53 2008
@@ -286,6 +286,48 @@
}
}
+static gboolean
+model_has_one_entry (GtkTreeModel *model)
+{
+ guint n_rows;
+
+ n_rows = gtk_tree_model_iter_n_children (model, NULL);
+ g_debug ("Model has %d rows", n_rows);
+
+ return (n_rows < 2);
+}
+
+static void
+update_dialog_text (GsmLogoutInhibitDialog *dialog)
+{
+ const char *header_text;
+ const char *description_text;
+ GtkWidget *widget;
+
+ if (model_has_one_entry (GTK_TREE_MODEL (dialog->priv->list_store))) {
+ g_debug ("Found one entry in model");
+ header_text = _("A program is still running:");
+ description_text = _("Interrupting this program may cause you to lose work.");
+ } else {
+ g_debug ("Found multiple entries in model");
+ header_text = _("Some programs are still running:");
+ description_text = _("Interrupting these programs may cause you to lose work.");
+ }
+
+ widget = glade_xml_get_widget (dialog->priv->xml, "header-label");
+ if (widget != NULL) {
+ char *markup;
+ markup = g_strdup_printf ("<b>%s</b>", header_text);
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ g_free (markup);
+ }
+
+ widget = glade_xml_get_widget (dialog->priv->xml, "description-label");
+ if (widget != NULL) {
+ gtk_label_set_text (GTK_LABEL (widget), description_text);
+ }
+}
+
static void
on_store_inhibitor_added (GsmInhibitorStore *store,
guint cookie,
@@ -301,6 +343,7 @@
/* Add to model */
if (! find_inhibitor (dialog, cookie, &iter)) {
add_inhibitor (dialog, inhibitor);
+ update_dialog_text (dialog);
}
}
@@ -317,6 +360,7 @@
/* Remove from model */
if (find_inhibitor (dialog, cookie, &iter)) {
gtk_list_store_remove (dialog->priv->list_store, &iter);
+ update_dialog_text (dialog);
}
/* if there are no inhibitors left then trigger response */
@@ -451,6 +495,7 @@
gsm_inhibitor_store_foreach_remove (dialog->priv->inhibitors,
(GsmInhibitorStoreFunc)add_to_model,
dialog);
+ update_dialog_text (dialog);
}
static void
Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade (original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.glade Thu Jun 26 00:18:53 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Tue Jun 24 11:01:14 2008 -->
+<!--Generated with glade3 3.4.4 on Wed Jun 25 19:36:21 2008 -->
<glade-interface>
<widget class="GtkDialog" id="dialog1">
<property name="border_width">5</property>
@@ -14,10 +14,10 @@
<child>
<widget class="GtkVBox" id="main-box">
<property name="visible">True</property>
- <property name="border_width">10</property>
+ <property name="border_width">6</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label1">
+ <widget class="GtkLabel" id="header-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"><b>Some programs are still running:</b></property>
@@ -32,13 +32,17 @@
<widget class="GtkTreeView" id="inhibitors-treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="enable_search">False</property>
+ <property name="show_expanders">False</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label2">
+ <widget class="GtkLabel" id="description-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Interrupting these programs may cause you to lose work. </property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]