From c4bd83aaf7c881fbaa1ae2502814ab14e2a66c8b Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Wed, 5 Aug 2009 15:51:59 +0200 Subject: Introduce indicate_indicator_set_server() so that server can be defined for message indicators too. --- libindicate/indicator.c | 21 +++++++++++++++++---- libindicate/indicator.h | 3 +++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libindicate/indicator.c b/libindicate/indicator.c index cb257eb..a526ce7 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -220,16 +220,29 @@ indicate_indicator_new_with_server (IndicateServer * server) IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL); + indicate_indicator_set_server (indicator, server); + + return indicator; +} + +void +indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server) +{ IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); + + if (server != NULL) { + g_object_ref(server); + } + if (priv->server != NULL) { + indicate_server_remove_indicator (priv->server, indicator); g_object_unref(priv->server); - priv->server = NULL; } priv->server = server; - g_object_ref(priv->server); - - return indicator; + if (server != NULL) { + indicate_server_add_indicator (server, indicator); + } } diff --git a/libindicate/indicator.h b/libindicate/indicator.h index 20b998d..b2e33c0 100644 --- a/libindicate/indicator.h +++ b/libindicate/indicator.h @@ -119,6 +119,9 @@ void indicate_indicator_hide (IndicateIndicator * indicator); gboolean indicate_indicator_is_visible (IndicateIndicator * indicator); +/* Define this indicator server */ +void indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server); + /* Every entry has an ID, here's how to get it */ guint indicate_indicator_get_id (IndicateIndicator * indicator); -- cgit v1.2.3 From 937dba5dd4878bc1f78cf76d6d24c19b69c800df Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Thu, 6 Aug 2009 15:43:38 +0200 Subject: Updated documentation --- libindicate/indicator.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libindicate/indicator.c b/libindicate/indicator.c index a526ce7..55964df 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -225,6 +225,14 @@ indicate_indicator_new_with_server (IndicateServer * server) return indicator; } +/** + indicate_indicator_set_server: + @indicator: a #IndicateIndicator to act on + @server: the #IndicateServer which should be associated with @indicator + + Defines which server this indicator must be associated to. Also, adds a + reference to the server. +*/ void indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server) { -- cgit v1.2.3 From 3b1bb35d97848e4ea444f963bf8c19ca6a72dd5b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 12:14:44 +0100 Subject: New src entry --- src-sus-only/Makefile.am | 16 +++ src-sus-only/applet-main.c | 348 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 364 insertions(+) create mode 100644 src-sus-only/Makefile.am create mode 100644 src-sus-only/applet-main.c diff --git a/src-sus-only/Makefile.am b/src-sus-only/Makefile.am new file mode 100644 index 0000000..97af739 --- /dev/null +++ b/src-sus-only/Makefile.am @@ -0,0 +1,16 @@ + +libexec_PROGRAMS = \ + indicator-applet + +indicator_applet_CFLAGS = \ + -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ + -I$(srcdir)/.. \ + $(APPLET_CFLAGS) + +indicator_applet_SOURCES = \ + applet-main.c + +indicator_applet_LDADD = \ + $(APPLET_LIBS) diff --git a/src-sus-only/applet-main.c b/src-sus-only/applet-main.c new file mode 100644 index 0000000..2aa03ee --- /dev/null +++ b/src-sus-only/applet-main.c @@ -0,0 +1,348 @@ +/* +A small wrapper utility to load indicators and put them as menu items +into the gnome-panel using it's applet interface. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#include +#include +#include + +#include "libindicator/indicator.h" + +#define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons") + +static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); + + +static void cw_panel_background_changed (PanelApplet *applet, + PanelAppletBackgroundType type, + GdkColor *colour, + GdkPixmap *pixmap, + GtkWidget *menubar); + +/* ****************** * + * Global Variables * + * ****************** */ + +static GnomeProgram *program = NULL; + + +/************* + * main + * ***********/ + +PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", + PANEL_TYPE_APPLET, + "indicator-applet", "0", + applet_fill_cb, NULL); + +/************* + * init function + * ***********/ +static gboolean +load_module (const gchar * name, GtkWidget * menu) +{ + g_debug("Looking at Module: %s", name); + g_return_val_if_fail(name != NULL, FALSE); + + if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { + return FALSE; + } + + g_debug("Loading Module: %s", name); + + gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); + GModule * module = g_module_open(fullpath, + G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + g_free(fullpath); + g_return_val_if_fail(module != NULL, FALSE); + + get_version_t lget_version = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE); + if (!INDICATOR_VERSION_CHECK(lget_version())) { + g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION); + return FALSE; + } + + get_label_t lget_label = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE); + g_return_val_if_fail(lget_label != NULL, FALSE); + GtkLabel * label = lget_label(); + + get_icon_t lget_icon = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE); + g_return_val_if_fail(lget_icon != NULL, FALSE); + GtkImage * icon = lget_icon(); + + get_menu_t lget_menu = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE); + g_return_val_if_fail(lget_menu != NULL, FALSE); + GtkMenu * lmenu = lget_menu(); + + if (label == NULL && icon == NULL) { + /* This is the case where there is nothing to display, + kinda odd that we'd have a module with nothing. */ + g_warning("No label or icon. Odd."); + return FALSE; + } + + GtkWidget * menuitem = gtk_menu_item_new(); + GtkWidget * hbox = gtk_hbox_new(FALSE, 3); + if (icon != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0); + } + if (label != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); + } + gtk_container_add(GTK_CONTAINER(menuitem), hbox); + gtk_widget_show(hbox); + + if (lmenu != NULL) { + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu)); + } + + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + gtk_widget_show(menuitem); + + return TRUE; +} + +static gboolean +menubar_press (GtkWidget * widget, + GdkEventButton *event, + gpointer data) +{ + if (event->button != 1) { + g_signal_stop_emission_by_name(widget, "button-press-event"); + } + + return FALSE; +} + +static gboolean +menubar_on_expose (GtkWidget * widget, + GdkEventExpose *event, + GtkWidget * menubar) +{ + if (GTK_WIDGET_HAS_FOCUS(menubar)) + gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar), + NULL, widget, "menubar-applet", 0, 0, -1, -1); + + return FALSE; +} + +static void +about_cb (BonoboUIComponent *ui_container, + gpointer data, + const gchar *cname) +{ + static const gchar *authors[] = { + "Ted Gould ", + NULL + }; + + static gchar *license[] = { + N_("This program is free software: you can redistribute it and/or modify it " + "under the terms of the GNU General Public License version 3, as published " + "by the Free Software Foundation."), + N_("This program is distributed in the hope that it will be useful, but " + "WITHOUT ANY WARRANTY; without even the implied warranties of " + "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR " + "PURPOSE. See the GNU General Public License for more details."), + N_("You should have received a copy of the GNU General Public License along " + "with this program. If not, see ."), + NULL + }; + gchar *license_i18n; + + license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); + + gtk_show_about_dialog(NULL, + "version", "0.1", + "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.", + "comments", _("An applet to hold all of the system indicators."), + "authors", authors, + "license", license_i18n, + "wrap-license", TRUE, + "translator-credits", _("translator-credits"), + "logo-icon-name", "indicator-applet", + "icon-name", "indicator-applet", + "website", "http://launchpad.net/indicator-applet", + "website-label", _("Indicator Applet Website"), + NULL + ); + + g_free (license_i18n); + + return; +} + +#ifdef N_ +#undef N_ +#endif +#define N_(x) x + +static gboolean +applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) +{ + static const BonoboUIVerb menu_verbs[] = { + BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb), + BONOBO_UI_VERB_END + }; + static const gchar * menu_xml = + "" + "" + ""; + + GtkWidget *menubar; + gint i; + gint indicators_loaded = 0; + static gboolean first_time = FALSE; + + if (!first_time) + { + gint argc = 1; + gchar *argv[2] = { "indicator-applet", NULL}; + + first_time = TRUE; + program = gnome_program_init ("indicator-applet", "0.1", + LIBGNOMEUI_MODULE, argc, argv, + GNOME_PROGRAM_STANDARD_PROPERTIES, + NULL); + } + + /* Set panel options */ + gtk_container_set_border_width(GTK_CONTAINER (applet), 0); + panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); + panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), + "indicator-applet"); + + /* Init some theme/icon stuff */ + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), + ICONS_DIR); + /* g_debug("Icons directory: %s", ICONS_DIR); */ + gtk_rc_parse_string ( + "style \"indicator-applet-style\"\n" + "{\n" + " GtkMenuBar::shadow-type = none\n" + " GtkMenuBar::internal-padding = 0\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + "}\n" + "style \"indicator-applet-menubar-style\"\n" + "{\n" + " GtkMenuBar::shadow-type = none\n" + " GtkMenuBar::internal-padding = 0\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + " GtkMenuItem::horizontal-padding = 0\n" + "}\n" + "style \"indicator-applet-menuitem-style\"\n" + "{\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + " GtkMenuItem::horizontal-padding = 0\n" + "}\n" + "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\"" + "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\"" + "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\""); + //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar"); + gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); + + /* Build menubar */ + menubar = gtk_menu_bar_new(); + GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS); + gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); + g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); + g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); + gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); + + /* load 'em */ + if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); + + const gchar * name; + while ((name = g_dir_read_name(dir)) != NULL) { + if (load_module(name, menubar)) + indicators_loaded++; + } + g_dir_close (dir); + } + + if (indicators_loaded == 0) { + /* A label to allow for click through */ + GtkWidget * item = gtk_label_new(_("No Indicators")); + gtk_container_add(GTK_CONTAINER(applet), item); + gtk_widget_show(item); + } else { + gtk_container_add(GTK_CONTAINER(applet), menubar); + panel_applet_set_background_widget(applet, menubar); + gtk_widget_show(menubar); + } + + /* Background of applet */ + g_signal_connect(applet, "change-background", + G_CALLBACK(cw_panel_background_changed), menubar); + + gtk_widget_show(GTK_WIDGET(applet)); + + return TRUE; +} + +static void +cw_panel_background_changed (PanelApplet *applet, + PanelAppletBackgroundType type, + GdkColor *colour, + GdkPixmap *pixmap, + GtkWidget *menubar) +{ + GtkRcStyle *rc_style; + GtkStyle *style; + + /* reset style */ + gtk_widget_set_style(GTK_WIDGET (applet), NULL); + gtk_widget_set_style(menubar, NULL); + rc_style = gtk_rc_style_new (); + gtk_widget_modify_style(GTK_WIDGET (applet), rc_style); + gtk_widget_modify_style(menubar, rc_style); + gtk_rc_style_unref(rc_style); + + switch (type) + { + case PANEL_NO_BACKGROUND: + break; + case PANEL_COLOR_BACKGROUND: + gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour); + gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour); + break; + + case PANEL_PIXMAP_BACKGROUND: + style = gtk_style_copy(GTK_WIDGET (applet)->style); + if (style->bg_pixmap[GTK_STATE_NORMAL]) + g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); + style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap); + gtk_widget_set_style(GTK_WIDGET (applet), style); + gtk_widget_set_style(GTK_WIDGET (menubar), style); + g_object_unref(style); + break; + } +} + -- cgit v1.2.3 From a1ec732767135917e9e0fd75514a39ac8d3c6485 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 14:13:05 +0100 Subject: Adding the new src to the build system --- Makefile.am | 1 + configure.ac | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index bdd32f4..c5c38b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ SUBDIRS = \ src \ + src-sus-only \ libindicate \ libindicate-gtk \ libindicator \ diff --git a/configure.ac b/configure.ac index 471512f..1cff1e0 100644 --- a/configure.ac +++ b/configure.ac @@ -180,6 +180,7 @@ AC_DEFINE_PATH(LIBDIR, "${libdir}", [system configuration dir]) AC_OUTPUT([ Makefile src/Makefile +src-sus-only/Makefile libindicate/Makefile libindicate/indicate.pc libindicate-gtk/Makefile -- cgit v1.2.3 From 99caa033d3e55596c78d9e86d931768c447b6586 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 14:15:15 +0100 Subject: Adding a new build target for our new applet --- .bzrignore | 1 + src-sus-only/Makefile.am | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.bzrignore b/.bzrignore index d1781cd..783d4b8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -99,3 +99,4 @@ docs/reference/tmpl/listener.sgml docs/reference/tmpl/listener.sgml.bak docs/reference/tmpl/server.sgml docs/reference/tmpl/server.sgml.bak +src-sus-only/indicator-applet-no-sus diff --git a/src-sus-only/Makefile.am b/src-sus-only/Makefile.am index 97af739..6e494f9 100644 --- a/src-sus-only/Makefile.am +++ b/src-sus-only/Makefile.am @@ -1,16 +1,16 @@ libexec_PROGRAMS = \ - indicator-applet + indicator-applet-no-sus -indicator_applet_CFLAGS = \ +indicator_applet_no_sus_CFLAGS = \ -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ -DDATADIR=\""$(datadir)"\" \ -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ -I$(srcdir)/.. \ $(APPLET_CFLAGS) -indicator_applet_SOURCES = \ +indicator_applet_no_sus_SOURCES = \ applet-main.c -indicator_applet_LDADD = \ +indicator_applet_no_sus_LDADD = \ $(APPLET_LIBS) -- cgit v1.2.3 From 5bc7f7d4b45e8aa2242c5681edc0715292dea030 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 14:19:27 +0100 Subject: Adding a new server to connect with our new applet. Still needs changes as it's just a copy. --- data/GNOME_FastUserSwitchApplet.server.in.in | 28 ++++++++++++++++++++++++++++ data/Makefile.am | 4 +++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 data/GNOME_FastUserSwitchApplet.server.in.in diff --git a/data/GNOME_FastUserSwitchApplet.server.in.in b/data/GNOME_FastUserSwitchApplet.server.in.in new file mode 100644 index 0000000..c576246 --- /dev/null +++ b/data/GNOME_FastUserSwitchApplet.server.in.in @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/Makefile.am b/data/Makefile.am index a03fadc..35b709b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -7,7 +7,8 @@ serverdir = \ $(libdir)/bonobo/servers server_in_files = \ - GNOME_IndicatorApplet.server.in + GNOME_IndicatorApplet.server.in \ + GNOME_FastUserSwitchApplet.server.in server_DATA = \ $(server_in_files:.server.in=.server) @@ -67,6 +68,7 @@ CLEANFILES = \ EXTRA_DIST = \ $(icons_DATA) \ GNOME_IndicatorApplet.server.in.in \ + GNOME_FastUserSwitchApplet.server.in.in \ $(schema_in_files) MAINTAINERCLEANFILES = \ -- cgit v1.2.3 From f2a3bfcd2998f70618ade166632036d30999ed72 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 14:21:31 +0100 Subject: Making the schema translatable --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index 0426b06..b4afbc6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,5 @@ [encoding: UTF-8] data/GNOME_IndicatorApplet.server.in.in +data/GNOME_FastUserSwitchApplet.server.in.in data/indicator-applet.schemas.in src/applet-main.c -- cgit v1.2.3 From 019d958217a16b8c816b90cf240c84ffc38cd2e8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 14:24:33 +0100 Subject: Adjusting the namespace. Just to make things fun like that. --- data/GNOME_FastUserSwitchApplet.server.in.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/GNOME_FastUserSwitchApplet.server.in.in b/data/GNOME_FastUserSwitchApplet.server.in.in index c576246..1f9ac5a 100644 --- a/data/GNOME_FastUserSwitchApplet.server.in.in +++ b/data/GNOME_FastUserSwitchApplet.server.in.in @@ -1,5 +1,5 @@ - @@ -13,16 +13,16 @@ - + - - + + -- cgit v1.2.3 From f33fa710e65205472c1c01ec2e4d7b8dacc7cabf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 15:32:30 +0100 Subject: Renaming the server file --- data/GNOME_FastUserSwitchApplet.server.in.in | 28 ---------------------------- data/GNOME_IndicatorAppletSUS.server.in.in | 28 ++++++++++++++++++++++++++++ data/Makefile.am | 4 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 data/GNOME_FastUserSwitchApplet.server.in.in create mode 100644 data/GNOME_IndicatorAppletSUS.server.in.in diff --git a/data/GNOME_FastUserSwitchApplet.server.in.in b/data/GNOME_FastUserSwitchApplet.server.in.in deleted file mode 100644 index 1f9ac5a..0000000 --- a/data/GNOME_FastUserSwitchApplet.server.in.in +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/GNOME_IndicatorAppletSUS.server.in.in b/data/GNOME_IndicatorAppletSUS.server.in.in new file mode 100644 index 0000000..1f9ac5a --- /dev/null +++ b/data/GNOME_IndicatorAppletSUS.server.in.in @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/Makefile.am b/data/Makefile.am index 35b709b..3eb84f2 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,7 +8,7 @@ serverdir = \ $(libdir)/bonobo/servers server_in_files = \ GNOME_IndicatorApplet.server.in \ - GNOME_FastUserSwitchApplet.server.in + GNOME_IndicatorAppletSUS.server.in server_DATA = \ $(server_in_files:.server.in=.server) @@ -68,7 +68,7 @@ CLEANFILES = \ EXTRA_DIST = \ $(icons_DATA) \ GNOME_IndicatorApplet.server.in.in \ - GNOME_FastUserSwitchApplet.server.in.in \ + GNOME_IndicatorAppletSUS.server.in.in \ $(schema_in_files) MAINTAINERCLEANFILES = \ -- cgit v1.2.3 From c35dbea8f670052a79830eee94375aebba48af2c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 15:45:40 +0100 Subject: New executable name --- data/GNOME_IndicatorAppletSUS.server.in.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/GNOME_IndicatorAppletSUS.server.in.in b/data/GNOME_IndicatorAppletSUS.server.in.in index 1f9ac5a..388713b 100644 --- a/data/GNOME_IndicatorAppletSUS.server.in.in +++ b/data/GNOME_IndicatorAppletSUS.server.in.in @@ -1,6 +1,6 @@ + location="@LIBEXECDIR@/indicator-applet-sus"> -- cgit v1.2.3 From 059f1bf7f05ff9237c04d60758cbcc2995932e82 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 15:53:10 +0100 Subject: Changing the name of the directory to -sus which makes more sense --- .bzrignore | 2 +- Makefile.am | 2 +- configure.ac | 2 +- src-sus-only/Makefile.am | 16 --- src-sus-only/applet-main.c | 348 --------------------------------------------- src-sus/Makefile.am | 16 +++ src-sus/applet-main.c | 348 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 367 insertions(+), 367 deletions(-) delete mode 100644 src-sus-only/Makefile.am delete mode 100644 src-sus-only/applet-main.c create mode 100644 src-sus/Makefile.am create mode 100644 src-sus/applet-main.c diff --git a/.bzrignore b/.bzrignore index 783d4b8..5adf2ab 100644 --- a/.bzrignore +++ b/.bzrignore @@ -99,4 +99,4 @@ docs/reference/tmpl/listener.sgml docs/reference/tmpl/listener.sgml.bak docs/reference/tmpl/server.sgml docs/reference/tmpl/server.sgml.bak -src-sus-only/indicator-applet-no-sus +src-sus/indicator-applet-sus diff --git a/Makefile.am b/Makefile.am index c5c38b4..072e8df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = \ src \ - src-sus-only \ + src-sus \ libindicate \ libindicate-gtk \ libindicator \ diff --git a/configure.ac b/configure.ac index 1cff1e0..58b4739 100644 --- a/configure.ac +++ b/configure.ac @@ -180,7 +180,7 @@ AC_DEFINE_PATH(LIBDIR, "${libdir}", [system configuration dir]) AC_OUTPUT([ Makefile src/Makefile -src-sus-only/Makefile +src-sus/Makefile libindicate/Makefile libindicate/indicate.pc libindicate-gtk/Makefile diff --git a/src-sus-only/Makefile.am b/src-sus-only/Makefile.am deleted file mode 100644 index 6e494f9..0000000 --- a/src-sus-only/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ - -libexec_PROGRAMS = \ - indicator-applet-no-sus - -indicator_applet_no_sus_CFLAGS = \ - -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ - -I$(srcdir)/.. \ - $(APPLET_CFLAGS) - -indicator_applet_no_sus_SOURCES = \ - applet-main.c - -indicator_applet_no_sus_LDADD = \ - $(APPLET_LIBS) diff --git a/src-sus-only/applet-main.c b/src-sus-only/applet-main.c deleted file mode 100644 index 2aa03ee..0000000 --- a/src-sus-only/applet-main.c +++ /dev/null @@ -1,348 +0,0 @@ -/* -A small wrapper utility to load indicators and put them as menu items -into the gnome-panel using it's applet interface. - -Copyright 2009 Canonical Ltd. - -Authors: - Ted Gould - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see . -*/ - -#include -#include -#include - -#include "libindicator/indicator.h" - -#define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons") - -static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); - - -static void cw_panel_background_changed (PanelApplet *applet, - PanelAppletBackgroundType type, - GdkColor *colour, - GdkPixmap *pixmap, - GtkWidget *menubar); - -/* ****************** * - * Global Variables * - * ****************** */ - -static GnomeProgram *program = NULL; - - -/************* - * main - * ***********/ - -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", - PANEL_TYPE_APPLET, - "indicator-applet", "0", - applet_fill_cb, NULL); - -/************* - * init function - * ***********/ -static gboolean -load_module (const gchar * name, GtkWidget * menu) -{ - g_debug("Looking at Module: %s", name); - g_return_val_if_fail(name != NULL, FALSE); - - if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { - return FALSE; - } - - g_debug("Loading Module: %s", name); - - gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); - GModule * module = g_module_open(fullpath, - G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); - g_free(fullpath); - g_return_val_if_fail(module != NULL, FALSE); - - get_version_t lget_version = NULL; - g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE); - if (!INDICATOR_VERSION_CHECK(lget_version())) { - g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION); - return FALSE; - } - - get_label_t lget_label = NULL; - g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE); - g_return_val_if_fail(lget_label != NULL, FALSE); - GtkLabel * label = lget_label(); - - get_icon_t lget_icon = NULL; - g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE); - g_return_val_if_fail(lget_icon != NULL, FALSE); - GtkImage * icon = lget_icon(); - - get_menu_t lget_menu = NULL; - g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE); - g_return_val_if_fail(lget_menu != NULL, FALSE); - GtkMenu * lmenu = lget_menu(); - - if (label == NULL && icon == NULL) { - /* This is the case where there is nothing to display, - kinda odd that we'd have a module with nothing. */ - g_warning("No label or icon. Odd."); - return FALSE; - } - - GtkWidget * menuitem = gtk_menu_item_new(); - GtkWidget * hbox = gtk_hbox_new(FALSE, 3); - if (icon != NULL) { - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0); - } - if (label != NULL) { - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); - } - gtk_container_add(GTK_CONTAINER(menuitem), hbox); - gtk_widget_show(hbox); - - if (lmenu != NULL) { - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu)); - } - - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - gtk_widget_show(menuitem); - - return TRUE; -} - -static gboolean -menubar_press (GtkWidget * widget, - GdkEventButton *event, - gpointer data) -{ - if (event->button != 1) { - g_signal_stop_emission_by_name(widget, "button-press-event"); - } - - return FALSE; -} - -static gboolean -menubar_on_expose (GtkWidget * widget, - GdkEventExpose *event, - GtkWidget * menubar) -{ - if (GTK_WIDGET_HAS_FOCUS(menubar)) - gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar), - NULL, widget, "menubar-applet", 0, 0, -1, -1); - - return FALSE; -} - -static void -about_cb (BonoboUIComponent *ui_container, - gpointer data, - const gchar *cname) -{ - static const gchar *authors[] = { - "Ted Gould ", - NULL - }; - - static gchar *license[] = { - N_("This program is free software: you can redistribute it and/or modify it " - "under the terms of the GNU General Public License version 3, as published " - "by the Free Software Foundation."), - N_("This program is distributed in the hope that it will be useful, but " - "WITHOUT ANY WARRANTY; without even the implied warranties of " - "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR " - "PURPOSE. See the GNU General Public License for more details."), - N_("You should have received a copy of the GNU General Public License along " - "with this program. If not, see ."), - NULL - }; - gchar *license_i18n; - - license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); - - gtk_show_about_dialog(NULL, - "version", "0.1", - "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.", - "comments", _("An applet to hold all of the system indicators."), - "authors", authors, - "license", license_i18n, - "wrap-license", TRUE, - "translator-credits", _("translator-credits"), - "logo-icon-name", "indicator-applet", - "icon-name", "indicator-applet", - "website", "http://launchpad.net/indicator-applet", - "website-label", _("Indicator Applet Website"), - NULL - ); - - g_free (license_i18n); - - return; -} - -#ifdef N_ -#undef N_ -#endif -#define N_(x) x - -static gboolean -applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) -{ - static const BonoboUIVerb menu_verbs[] = { - BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb), - BONOBO_UI_VERB_END - }; - static const gchar * menu_xml = - "" - "" - ""; - - GtkWidget *menubar; - gint i; - gint indicators_loaded = 0; - static gboolean first_time = FALSE; - - if (!first_time) - { - gint argc = 1; - gchar *argv[2] = { "indicator-applet", NULL}; - - first_time = TRUE; - program = gnome_program_init ("indicator-applet", "0.1", - LIBGNOMEUI_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - NULL); - } - - /* Set panel options */ - gtk_container_set_border_width(GTK_CONTAINER (applet), 0); - panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); - panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), - "indicator-applet"); - - /* Init some theme/icon stuff */ - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), - ICONS_DIR); - /* g_debug("Icons directory: %s", ICONS_DIR); */ - gtk_rc_parse_string ( - "style \"indicator-applet-style\"\n" - "{\n" - " GtkMenuBar::shadow-type = none\n" - " GtkMenuBar::internal-padding = 0\n" - " GtkWidget::focus-line-width = 0\n" - " GtkWidget::focus-padding = 0\n" - "}\n" - "style \"indicator-applet-menubar-style\"\n" - "{\n" - " GtkMenuBar::shadow-type = none\n" - " GtkMenuBar::internal-padding = 0\n" - " GtkWidget::focus-line-width = 0\n" - " GtkWidget::focus-padding = 0\n" - " GtkMenuItem::horizontal-padding = 0\n" - "}\n" - "style \"indicator-applet-menuitem-style\"\n" - "{\n" - " GtkWidget::focus-line-width = 0\n" - " GtkWidget::focus-padding = 0\n" - " GtkMenuItem::horizontal-padding = 0\n" - "}\n" - "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\"" - "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\"" - "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\""); - //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar"); - gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); - - /* Build menubar */ - menubar = gtk_menu_bar_new(); - GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS); - gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); - g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); - g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); - gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); - - /* load 'em */ - if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { - GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); - - const gchar * name; - while ((name = g_dir_read_name(dir)) != NULL) { - if (load_module(name, menubar)) - indicators_loaded++; - } - g_dir_close (dir); - } - - if (indicators_loaded == 0) { - /* A label to allow for click through */ - GtkWidget * item = gtk_label_new(_("No Indicators")); - gtk_container_add(GTK_CONTAINER(applet), item); - gtk_widget_show(item); - } else { - gtk_container_add(GTK_CONTAINER(applet), menubar); - panel_applet_set_background_widget(applet, menubar); - gtk_widget_show(menubar); - } - - /* Background of applet */ - g_signal_connect(applet, "change-background", - G_CALLBACK(cw_panel_background_changed), menubar); - - gtk_widget_show(GTK_WIDGET(applet)); - - return TRUE; -} - -static void -cw_panel_background_changed (PanelApplet *applet, - PanelAppletBackgroundType type, - GdkColor *colour, - GdkPixmap *pixmap, - GtkWidget *menubar) -{ - GtkRcStyle *rc_style; - GtkStyle *style; - - /* reset style */ - gtk_widget_set_style(GTK_WIDGET (applet), NULL); - gtk_widget_set_style(menubar, NULL); - rc_style = gtk_rc_style_new (); - gtk_widget_modify_style(GTK_WIDGET (applet), rc_style); - gtk_widget_modify_style(menubar, rc_style); - gtk_rc_style_unref(rc_style); - - switch (type) - { - case PANEL_NO_BACKGROUND: - break; - case PANEL_COLOR_BACKGROUND: - gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour); - gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour); - break; - - case PANEL_PIXMAP_BACKGROUND: - style = gtk_style_copy(GTK_WIDGET (applet)->style); - if (style->bg_pixmap[GTK_STATE_NORMAL]) - g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); - style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap); - gtk_widget_set_style(GTK_WIDGET (applet), style); - gtk_widget_set_style(GTK_WIDGET (menubar), style); - g_object_unref(style); - break; - } -} - diff --git a/src-sus/Makefile.am b/src-sus/Makefile.am new file mode 100644 index 0000000..6e494f9 --- /dev/null +++ b/src-sus/Makefile.am @@ -0,0 +1,16 @@ + +libexec_PROGRAMS = \ + indicator-applet-no-sus + +indicator_applet_no_sus_CFLAGS = \ + -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ + -I$(srcdir)/.. \ + $(APPLET_CFLAGS) + +indicator_applet_no_sus_SOURCES = \ + applet-main.c + +indicator_applet_no_sus_LDADD = \ + $(APPLET_LIBS) diff --git a/src-sus/applet-main.c b/src-sus/applet-main.c new file mode 100644 index 0000000..2aa03ee --- /dev/null +++ b/src-sus/applet-main.c @@ -0,0 +1,348 @@ +/* +A small wrapper utility to load indicators and put them as menu items +into the gnome-panel using it's applet interface. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#include +#include +#include + +#include "libindicator/indicator.h" + +#define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons") + +static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); + + +static void cw_panel_background_changed (PanelApplet *applet, + PanelAppletBackgroundType type, + GdkColor *colour, + GdkPixmap *pixmap, + GtkWidget *menubar); + +/* ****************** * + * Global Variables * + * ****************** */ + +static GnomeProgram *program = NULL; + + +/************* + * main + * ***********/ + +PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", + PANEL_TYPE_APPLET, + "indicator-applet", "0", + applet_fill_cb, NULL); + +/************* + * init function + * ***********/ +static gboolean +load_module (const gchar * name, GtkWidget * menu) +{ + g_debug("Looking at Module: %s", name); + g_return_val_if_fail(name != NULL, FALSE); + + if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { + return FALSE; + } + + g_debug("Loading Module: %s", name); + + gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); + GModule * module = g_module_open(fullpath, + G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + g_free(fullpath); + g_return_val_if_fail(module != NULL, FALSE); + + get_version_t lget_version = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE); + if (!INDICATOR_VERSION_CHECK(lget_version())) { + g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION); + return FALSE; + } + + get_label_t lget_label = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE); + g_return_val_if_fail(lget_label != NULL, FALSE); + GtkLabel * label = lget_label(); + + get_icon_t lget_icon = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE); + g_return_val_if_fail(lget_icon != NULL, FALSE); + GtkImage * icon = lget_icon(); + + get_menu_t lget_menu = NULL; + g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE); + g_return_val_if_fail(lget_menu != NULL, FALSE); + GtkMenu * lmenu = lget_menu(); + + if (label == NULL && icon == NULL) { + /* This is the case where there is nothing to display, + kinda odd that we'd have a module with nothing. */ + g_warning("No label or icon. Odd."); + return FALSE; + } + + GtkWidget * menuitem = gtk_menu_item_new(); + GtkWidget * hbox = gtk_hbox_new(FALSE, 3); + if (icon != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0); + } + if (label != NULL) { + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0); + } + gtk_container_add(GTK_CONTAINER(menuitem), hbox); + gtk_widget_show(hbox); + + if (lmenu != NULL) { + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu)); + } + + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + gtk_widget_show(menuitem); + + return TRUE; +} + +static gboolean +menubar_press (GtkWidget * widget, + GdkEventButton *event, + gpointer data) +{ + if (event->button != 1) { + g_signal_stop_emission_by_name(widget, "button-press-event"); + } + + return FALSE; +} + +static gboolean +menubar_on_expose (GtkWidget * widget, + GdkEventExpose *event, + GtkWidget * menubar) +{ + if (GTK_WIDGET_HAS_FOCUS(menubar)) + gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar), + NULL, widget, "menubar-applet", 0, 0, -1, -1); + + return FALSE; +} + +static void +about_cb (BonoboUIComponent *ui_container, + gpointer data, + const gchar *cname) +{ + static const gchar *authors[] = { + "Ted Gould ", + NULL + }; + + static gchar *license[] = { + N_("This program is free software: you can redistribute it and/or modify it " + "under the terms of the GNU General Public License version 3, as published " + "by the Free Software Foundation."), + N_("This program is distributed in the hope that it will be useful, but " + "WITHOUT ANY WARRANTY; without even the implied warranties of " + "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR " + "PURPOSE. See the GNU General Public License for more details."), + N_("You should have received a copy of the GNU General Public License along " + "with this program. If not, see ."), + NULL + }; + gchar *license_i18n; + + license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); + + gtk_show_about_dialog(NULL, + "version", "0.1", + "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.", + "comments", _("An applet to hold all of the system indicators."), + "authors", authors, + "license", license_i18n, + "wrap-license", TRUE, + "translator-credits", _("translator-credits"), + "logo-icon-name", "indicator-applet", + "icon-name", "indicator-applet", + "website", "http://launchpad.net/indicator-applet", + "website-label", _("Indicator Applet Website"), + NULL + ); + + g_free (license_i18n); + + return; +} + +#ifdef N_ +#undef N_ +#endif +#define N_(x) x + +static gboolean +applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) +{ + static const BonoboUIVerb menu_verbs[] = { + BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb), + BONOBO_UI_VERB_END + }; + static const gchar * menu_xml = + "" + "" + ""; + + GtkWidget *menubar; + gint i; + gint indicators_loaded = 0; + static gboolean first_time = FALSE; + + if (!first_time) + { + gint argc = 1; + gchar *argv[2] = { "indicator-applet", NULL}; + + first_time = TRUE; + program = gnome_program_init ("indicator-applet", "0.1", + LIBGNOMEUI_MODULE, argc, argv, + GNOME_PROGRAM_STANDARD_PROPERTIES, + NULL); + } + + /* Set panel options */ + gtk_container_set_border_width(GTK_CONTAINER (applet), 0); + panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); + panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), + "indicator-applet"); + + /* Init some theme/icon stuff */ + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), + ICONS_DIR); + /* g_debug("Icons directory: %s", ICONS_DIR); */ + gtk_rc_parse_string ( + "style \"indicator-applet-style\"\n" + "{\n" + " GtkMenuBar::shadow-type = none\n" + " GtkMenuBar::internal-padding = 0\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + "}\n" + "style \"indicator-applet-menubar-style\"\n" + "{\n" + " GtkMenuBar::shadow-type = none\n" + " GtkMenuBar::internal-padding = 0\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + " GtkMenuItem::horizontal-padding = 0\n" + "}\n" + "style \"indicator-applet-menuitem-style\"\n" + "{\n" + " GtkWidget::focus-line-width = 0\n" + " GtkWidget::focus-padding = 0\n" + " GtkMenuItem::horizontal-padding = 0\n" + "}\n" + "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\"" + "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\"" + "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\""); + //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar"); + gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); + + /* Build menubar */ + menubar = gtk_menu_bar_new(); + GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS); + gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); + g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); + g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); + gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); + + /* load 'em */ + if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); + + const gchar * name; + while ((name = g_dir_read_name(dir)) != NULL) { + if (load_module(name, menubar)) + indicators_loaded++; + } + g_dir_close (dir); + } + + if (indicators_loaded == 0) { + /* A label to allow for click through */ + GtkWidget * item = gtk_label_new(_("No Indicators")); + gtk_container_add(GTK_CONTAINER(applet), item); + gtk_widget_show(item); + } else { + gtk_container_add(GTK_CONTAINER(applet), menubar); + panel_applet_set_background_widget(applet, menubar); + gtk_widget_show(menubar); + } + + /* Background of applet */ + g_signal_connect(applet, "change-background", + G_CALLBACK(cw_panel_background_changed), menubar); + + gtk_widget_show(GTK_WIDGET(applet)); + + return TRUE; +} + +static void +cw_panel_background_changed (PanelApplet *applet, + PanelAppletBackgroundType type, + GdkColor *colour, + GdkPixmap *pixmap, + GtkWidget *menubar) +{ + GtkRcStyle *rc_style; + GtkStyle *style; + + /* reset style */ + gtk_widget_set_style(GTK_WIDGET (applet), NULL); + gtk_widget_set_style(menubar, NULL); + rc_style = gtk_rc_style_new (); + gtk_widget_modify_style(GTK_WIDGET (applet), rc_style); + gtk_widget_modify_style(menubar, rc_style); + gtk_rc_style_unref(rc_style); + + switch (type) + { + case PANEL_NO_BACKGROUND: + break; + case PANEL_COLOR_BACKGROUND: + gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour); + gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour); + break; + + case PANEL_PIXMAP_BACKGROUND: + style = gtk_style_copy(GTK_WIDGET (applet)->style); + if (style->bg_pixmap[GTK_STATE_NORMAL]) + g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); + style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap); + gtk_widget_set_style(GTK_WIDGET (applet), style); + gtk_widget_set_style(GTK_WIDGET (menubar), style); + g_object_unref(style); + break; + } +} + -- cgit v1.2.3 From 2f92722014cba4a0709d33245820b1a2068786c4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 15:57:14 +0100 Subject: Switching the name to actually be correct. --- src-sus/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src-sus/Makefile.am b/src-sus/Makefile.am index 6e494f9..4a043ca 100644 --- a/src-sus/Makefile.am +++ b/src-sus/Makefile.am @@ -1,16 +1,16 @@ libexec_PROGRAMS = \ - indicator-applet-no-sus + indicator-applet-sus -indicator_applet_no_sus_CFLAGS = \ +indicator_applet_sus_CFLAGS = \ -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ -DDATADIR=\""$(datadir)"\" \ -DINDICATOR_DIR=\""$(libdir)/indicators/2"\" \ -I$(srcdir)/.. \ $(APPLET_CFLAGS) -indicator_applet_no_sus_SOURCES = \ +indicator_applet_sus_SOURCES = \ applet-main.c -indicator_applet_no_sus_LDADD = \ +indicator_applet_sus_LDADD = \ $(APPLET_LIBS) -- cgit v1.2.3 From 327dfdb08cbeb0208b51189ba5d5ca5113b6d257 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 16:06:32 +0100 Subject: Ignoring more files. --- .bzrignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bzrignore b/.bzrignore index 5adf2ab..b8537d5 100644 --- a/.bzrignore +++ b/.bzrignore @@ -100,3 +100,6 @@ docs/reference/tmpl/listener.sgml.bak docs/reference/tmpl/server.sgml docs/reference/tmpl/server.sgml.bak src-sus/indicator-applet-sus +data/GNOME_IndicatorAppletSUS.server +data/GNOME_IndicatorAppletSUS.server.in +src-sus/indicator-applet-no-sus -- cgit v1.2.3 From 3bb78064ad72b0f49b67e306dc3ba428c9abcfb3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 16:55:23 +0100 Subject: Fixing the generation rules for the bonobo server files. --- data/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/Makefile.am b/data/Makefile.am index 3eb84f2..c94932d 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -12,7 +12,7 @@ server_in_files = \ server_DATA = \ $(server_in_files:.server.in=.server) -$(server_in_files): $(server_in_files:.server.in=.server.in.in) +%.server.in: %.server.in.in sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@ @INTLTOOL_SERVER_RULE@ -- cgit v1.2.3 From 6c07c799edd3a1413145e0f29c2547698d861715 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 17:41:21 +0100 Subject: Blocking out SUS from standard applet. --- src/applet-main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/applet-main.c b/src/applet-main.c index 2aa03ee..3048e83 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -281,8 +281,12 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) const gchar * name; while ((name = g_dir_read_name(dir)) != NULL) { - if (load_module(name, menubar)) + if (!g_strcmp0(name, "libstatus-users-session.so")) { + continue; + } + if (load_module(name, menubar)) { indicators_loaded++; + } } g_dir_close (dir); } -- cgit v1.2.3 From 65df6f19b921da2a6d54062df20fa96182005994 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 17:43:09 +0100 Subject: Loading only the SUS plugin. --- src-sus/applet-main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src-sus/applet-main.c b/src-sus/applet-main.c index 2aa03ee..34440d8 100644 --- a/src-sus/applet-main.c +++ b/src-sus/applet-main.c @@ -281,8 +281,12 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) const gchar * name; while ((name = g_dir_read_name(dir)) != NULL) { - if (load_module(name, menubar)) - indicators_loaded++; + if (g_strcmp0(name, "libstatus-users-session.so")) { + continue; + } + if (load_module(name, menubar)) { + indicators_loaded++; + } } g_dir_close (dir); } -- cgit v1.2.3 From 8fd9f27b56503242b97313e0f758c01195fe2f79 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:17:42 +0100 Subject: Switching the name to the proper server file. --- po/POTFILES.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index b4afbc6..2d4cb1d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,5 @@ [encoding: UTF-8] data/GNOME_IndicatorApplet.server.in.in -data/GNOME_FastUserSwitchApplet.server.in.in +data/GNOME_IndicatorAppletSUS.server.in.in data/indicator-applet.schemas.in src/applet-main.c -- cgit v1.2.3 From 93135b103822476a99a7eeffbdd47c3634d2ba4a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:30:27 +0100 Subject: * debian/control: Adding information on indicator-applet-sus which is a different applet for the SUS indicator. * debian/indicator-applet.install: Making it more specific so that it doesn't grab the directories that now have additional files created by indicator-applet-sus existing. * debian/indicator-applet-sus.install: List files that are now used by the new binary package. --- debian/changelog | 7 +++++++ debian/control | 13 +++++++++++++ debian/indicator-applet-sus.install | 2 ++ debian/indicator-applet.install | 6 +++--- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 debian/indicator-applet-sus.install diff --git a/debian/changelog b/debian/changelog index d64362f..7e94921 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,13 @@ indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) UNRELEASED; urgency=low * Updating from upstream with two (count them) two applets installed in the source. + * debian/control: Adding information on indicator-applet-sus which + is a different applet for the SUS indicator. + * debian/indicator-applet.install: Making it more specific so that + it doesn't grab the directories that now have additional files + created by indicator-applet-sus existing. + * debian/indicator-applet-sus.install: List files that are now + used by the new binary package. -- Ted Gould Fri, 07 Aug 2009 18:18:17 +0100 diff --git a/debian/control b/debian/control index 4281a15..57cadef 100644 --- a/debian/control +++ b/debian/control @@ -30,6 +30,19 @@ Description: GNOME panel indicator applet Currently this includes support for messaging applications in the indicator-messages package. +Package: indicator-applet-sus +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + gnome-panel, + indicator-applet +Description: A clone of the GNOME panel indicator applet. + Indicator-applet is an applet to display information from + various applications consistently in the GNOME panel. + . + This instance will only load the SUS indicator which provies + status changing, user choosing and session management. + Package: libindicate2 Section: libs Conflicts: libindicate diff --git a/debian/indicator-applet-sus.install b/debian/indicator-applet-sus.install new file mode 100644 index 0000000..6bb7e07 --- /dev/null +++ b/debian/indicator-applet-sus.install @@ -0,0 +1,2 @@ +debian/tmp/usr/lib/bonobo/servers/GNOME_IndicatorAppletSUS.server +debian/tmp/usr/lib/indicator-applet/indicator-applet-sus diff --git a/debian/indicator-applet.install b/debian/indicator-applet.install index a6e5326..772d432 100644 --- a/debian/indicator-applet.install +++ b/debian/indicator-applet.install @@ -1,4 +1,4 @@ -debian/tmp/etc -debian/tmp/usr/lib/bonobo -debian/tmp/usr/lib/indicator-applet +debian/tmp/usr/lib/bonobo/servers/GNOME_IndicatorApplet.server +debian/tmp/usr/lib/indicator-applet/indicator-applet +debian/tmp/usr/lib/indicator-applet/listen-and-print debian/tmp/usr/share/icons -- cgit v1.2.3 From 709f0a835c44065571debf2ff1a9c428aed3a56f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:31:45 +0100 Subject: Locking the version number so the two indicator-applets are the same --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 57cadef..86c1447 100644 --- a/debian/control +++ b/debian/control @@ -35,7 +35,7 @@ Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-panel, - indicator-applet + indicator-applet (= ${binary:Version}) Description: A clone of the GNOME panel indicator applet. Indicator-applet is an applet to display information from various applications consistently in the GNOME panel. -- cgit v1.2.3 From 38e4c747a4c637441224b8c20092d15a330ad257 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:38:59 +0100 Subject: Oops, we need more identity. --- src-sus/applet-main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src-sus/applet-main.c b/src-sus/applet-main.c index 34440d8..0e43923 100644 --- a/src-sus/applet-main.c +++ b/src-sus/applet-main.c @@ -48,9 +48,9 @@ static GnomeProgram *program = NULL; * main * ***********/ -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", +PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory", PANEL_TYPE_APPLET, - "indicator-applet", "0", + "indicator-applet-sus", "0", applet_fill_cb, NULL); /************* @@ -219,10 +219,10 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) if (!first_time) { gint argc = 1; - gchar *argv[2] = { "indicator-applet", NULL}; + gchar *argv[2] = { "indicator-applet-sus", NULL}; first_time = TRUE; - program = gnome_program_init ("indicator-applet", "0.1", + program = gnome_program_init ("indicator-applet-sus", "0.1", LIBGNOMEUI_MODULE, argc, argv, GNOME_PROGRAM_STANDARD_PROPERTIES, NULL); @@ -233,7 +233,7 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), - "indicator-applet"); + "indicator-applet-sus"); /* Init some theme/icon stuff */ gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), -- cgit v1.2.3 From 31fac01d9186c896eb683e5888e9d8943795a82e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:40:03 +0100 Subject: releasing version 0.2.0~bzr319-0ubuntu5~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7e94921..cfabf01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) UNRELEASED; urgency=low +indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) karmic; urgency=low * Updating from upstream with two (count them) two applets installed in the source. @@ -10,7 +10,7 @@ indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) UNRELEASED; urgency=low * debian/indicator-applet-sus.install: List files that are now used by the new binary package. - -- Ted Gould Fri, 07 Aug 2009 18:18:17 +0100 + -- Ted Gould Fri, 07 Aug 2009 18:39:59 +0100 indicator-applet (0.2.0~bzr319-0ubuntu4) karmic; urgency=low -- cgit v1.2.3 From e97463ed73f9c8b6004a56315d4403e36bbcf781 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:40:19 +0100 Subject: Upstream merge for better naming of the applet. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index cfabf01..e33e0c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +indicator-applet (0.2.0~bzr319-0ubuntu5~ppa2) UNRELEASED; urgency=low + + * Upstream merge for better naming of the applet. + + -- Ted Gould Fri, 07 Aug 2009 18:40:07 +0100 + indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) karmic; urgency=low * Updating from upstream with two (count them) two applets -- cgit v1.2.3 From 721b0f9ae27da0727faec06a0add00a384714999 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:40:26 +0100 Subject: releasing version 0.2.0~bzr319-0ubuntu5~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e33e0c4..b43ca4c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-applet (0.2.0~bzr319-0ubuntu5~ppa2) UNRELEASED; urgency=low +indicator-applet (0.2.0~bzr319-0ubuntu5~ppa2) karmic; urgency=low * Upstream merge for better naming of the applet. - -- Ted Gould Fri, 07 Aug 2009 18:40:07 +0100 + -- Ted Gould Fri, 07 Aug 2009 18:40:22 +0100 indicator-applet (0.2.0~bzr319-0ubuntu5~ppa1) karmic; urgency=low -- cgit v1.2.3 From 3a8b5caef72bd16f0fb4da9bb4b27b7c8b95f16e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:47:02 +0100 Subject: Changing the Bonobo server description file name to match that of FUSA. --- data/GNOME_FastUserSwitchApplet.server.in.in | 28 ++++++++++++++++++++++++++++ data/GNOME_IndicatorAppletSUS.server.in.in | 28 ---------------------------- data/Makefile.am | 4 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 data/GNOME_FastUserSwitchApplet.server.in.in delete mode 100644 data/GNOME_IndicatorAppletSUS.server.in.in diff --git a/data/GNOME_FastUserSwitchApplet.server.in.in b/data/GNOME_FastUserSwitchApplet.server.in.in new file mode 100644 index 0000000..388713b --- /dev/null +++ b/data/GNOME_FastUserSwitchApplet.server.in.in @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/GNOME_IndicatorAppletSUS.server.in.in b/data/GNOME_IndicatorAppletSUS.server.in.in deleted file mode 100644 index 388713b..0000000 --- a/data/GNOME_IndicatorAppletSUS.server.in.in +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/Makefile.am b/data/Makefile.am index c94932d..0908bb0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,7 +8,7 @@ serverdir = \ $(libdir)/bonobo/servers server_in_files = \ GNOME_IndicatorApplet.server.in \ - GNOME_IndicatorAppletSUS.server.in + GNOME_FastUserSwitchApplet.server.in server_DATA = \ $(server_in_files:.server.in=.server) @@ -68,7 +68,7 @@ CLEANFILES = \ EXTRA_DIST = \ $(icons_DATA) \ GNOME_IndicatorApplet.server.in.in \ - GNOME_IndicatorAppletSUS.server.in.in \ + GNOME_FastUserSwitchApplet.server.in.in \ $(schema_in_files) MAINTAINERCLEANFILES = \ -- cgit v1.2.3 From 853ef5b9085fa6167babd0e8ea962666eeab3d7f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 7 Aug 2009 18:50:37 +0100 Subject: releasing version 0.2.0~bzr319-0ubuntu5~ppa3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index c3d7cf1..9e95ed4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-applet (0.2.0~bzr319-0ubuntu5~ppa3) UNRELEASED; urgency=low +indicator-applet (0.2.0~bzr319-0ubuntu5~ppa3) karmic; urgency=low * Renaming the second Bonobo server description file to match that of the FastUserSwitchApplet. - -- Ted Gould Fri, 07 Aug 2009 18:50:02 +0100 + -- Ted Gould Fri, 07 Aug 2009 18:50:33 +0100 indicator-applet (0.2.0~bzr319-0ubuntu5~ppa2) karmic; urgency=low -- cgit v1.2.3