[Xfce4-commits] [xfce/xfce4-power-manager] 57/63: Settings: Select the device-id

noreply at xfce.org noreply at xfce.org
Sun Mar 22 13:02:52 CET 2015


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

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit fb7ecef4b7a794934e1527b6682ecc0373f3ed00
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Fri Mar 20 11:41:13 2015 +0300

    Settings: Select the device-id
    
    When the device-id is selected after the window is open, switch
    to the devices tab and select it.
---
 settings/xfpm-settings-app.c |    6 ++++++
 settings/xfpm-settings.c     |   28 ++++++++++++++++++++++++++++
 settings/xfpm-settings.h     |    2 ++
 3 files changed, 36 insertions(+)

diff --git a/settings/xfpm-settings-app.c b/settings/xfpm-settings-app.c
index a50f7f6..cfbb553 100644
--- a/settings/xfpm-settings-app.c
+++ b/settings/xfpm-settings-app.c
@@ -147,6 +147,12 @@ xfpm_settings_app_launch (GApplication *app)
         DBG("window already opened, presenting it");
         gtk_window_present (GTK_WINDOW (windows->data));
         gdk_notify_startup_complete ();
+
+        if (priv->device_id != NULL)
+        {
+            xfpm_settings_show_device_id (priv->device_id);
+        }
+
         return;
     }
 
diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index a95e595..30d5658 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -2387,3 +2387,31 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
 
     return dialog;
 }
+
+void
+xfpm_settings_show_device_id (gchar *device_id)
+{
+    GtkTreeIter *device_iter;
+
+    if (device_id == NULL)
+	return;
+
+    gtk_widget_show (gtk_notebook_get_nth_page (GTK_NOTEBOOK (nt), devices_page_num));
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (nt), devices_page_num);
+
+    DBG("device_id %s", device_id);
+
+    device_iter = find_device_in_tree (device_id);
+    if (device_iter)
+    {
+        GtkTreeSelection *selection;
+
+	DBG("device found");
+
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sideview));
+
+	gtk_tree_selection_select_iter (selection, device_iter);
+	view_cursor_changed_cb (GTK_TREE_VIEW (sideview), NULL);
+	gtk_tree_iter_free (device_iter);
+    }
+}
diff --git a/settings/xfpm-settings.h b/settings/xfpm-settings.h
index b063b8c..1e5e1a1 100644
--- a/settings/xfpm-settings.h
+++ b/settings/xfpm-settings.h
@@ -39,4 +39,6 @@ GtkWidget *xfpm_settings_dialog_new (XfconfChannel *channel,
                                      Window id,
                                      gchar *device_id);
 
+void     xfpm_settings_show_device_id (gchar *device_id);
+
 #endif /* __XFPM_SETTINGS_H */

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


More information about the Xfce4-commits mailing list