[gupnp-tools] Added command line argument for exclusive change
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools] Added command line argument for exclusive change
- Date: Sun, 3 Apr 2016 17:07:18 +0000 (UTC)
commit 7cced18ffe3786c69735e4985f1c55a313250186
Author: ljsachs <larry j sachs intel com>
Date: Tue Mar 29 11:09:22 2016 -0700
Added command line argument for exclusive change
https://bugzilla.gnome.org/show_bug.cgi?id=761968
src/network-light/gui.c | 24 ++++++++++++++++++++----
src/network-light/gui.h | 3 ++-
src/network-light/main.c | 4 +++-
3 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/src/network-light/gui.c b/src/network-light/gui.c
index d02d70b..b143ec5 100644
--- a/src/network-light/gui.c
+++ b/src/network-light/gui.c
@@ -38,6 +38,7 @@ static GtkWidget *main_window;
static GtkWidget *about_dialog;
static GdkPixbuf *on_pixbuf;
static GdkPixbuf *off_pixbuf;
+static gboolean change_all = TRUE; // ui changes apply to all devices
void
on_light_status_menuitem_activate (GtkCheckMenuItem *menuitem,
@@ -98,7 +99,11 @@ void
on_light_status_menuitem_activate (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
- set_all_status (gtk_check_menu_item_get_active (menuitem));
+ if (change_all) {
+ set_all_status (gtk_check_menu_item_get_active (menuitem));
+ } else {
+ set_status (gtk_check_menu_item_get_active (menuitem));
+ }
}
G_MODULE_EXPORT
@@ -114,7 +119,11 @@ void
on_increase_luminance_menuitem_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- set_all_load_level (get_load_level () + 20);
+ if (change_all) {
+ set_all_load_level (get_load_level () + 20);
+ } else {
+ set_load_level (get_load_level () + 20);
+ }
}
G_MODULE_EXPORT
@@ -122,7 +131,11 @@ void
on_decrease_luminance_menuitem_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- set_all_load_level (get_load_level () - 20);
+ if (change_all) {
+ set_all_load_level (get_load_level () - 20);
+ } else {
+ set_load_level (get_load_level () - 20);
+ }
}
static void
@@ -192,11 +205,14 @@ on_delete_event (GtkWidget *widget,
gboolean
init_ui (gint *argc,
gchar **argv[],
- gchar *name)
+ gchar *name,
+ gboolean exclusive)
{
GdkPixbuf *icon_pixbuf;
GError *error = NULL;
+ change_all = !exclusive;
+
gtk_init (argc, argv);
builder = gtk_builder_new ();
diff --git a/src/network-light/gui.h b/src/network-light/gui.h
index 1ab2f0c..77e3243 100644
--- a/src/network-light/gui.h
+++ b/src/network-light/gui.h
@@ -29,7 +29,8 @@ update_image (void);
gboolean
init_ui (gint *argc,
gchar **argv[],
- gchar *name);
+ gchar *name,
+ gboolean exclusive);
void
deinit_ui (void);
diff --git a/src/network-light/main.c b/src/network-light/main.c
index b5b2f2e..5f62d8e 100644
--- a/src/network-light/main.c
+++ b/src/network-light/main.c
@@ -41,12 +41,14 @@ static gint light_load_level;
static int upnp_port = 0;
static char **interfaces = NULL;
static char *name = NULL;
+static gboolean exclusive;
static GOptionEntry entries[] =
{
{ "port", 'p', 0, G_OPTION_ARG_INT, &upnp_port, N_("Network PORT to use for UPnP"), "PORT" },
{ "interface", 'i', 0, G_OPTION_ARG_STRING_ARRAY, &interfaces, N_("Network interfaces to use for
UPnP communication"), "INTERFACE" },
{ "name", 'n', 0, G_OPTION_ARG_STRING, &name, N_("Friendly name for this UPnP light"), "NAME" },
+ { "exclusive", 'x', 0, G_OPTION_ARG_NONE, &exclusive, N_("Apply change exclusively to this UPnP
light"), NULL },
{ NULL }
};
@@ -109,7 +111,7 @@ main (int argc, char **argv)
return -4;
}
- if (!init_ui (&argc, &argv, name)) {
+ if (!init_ui (&argc, &argv, name, exclusive)) {
return -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]