aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorseb128 <seb128@seb128-desktop>2009-03-16 23:22:15 +0100
committerseb128 <seb128@seb128-desktop>2009-03-16 23:22:15 +0100
commitdeccbbbcacf975b79d2a6586767dddd8d1962b14 (patch)
treee6f35e7c909b9f8d5c2b5f1c144deea9224398f3 /src
parent3bc5b8e8105d698e7782c8090148dbe8f135161f (diff)
parentdab5af7f6bbfdb69e62b8378b6c8770ffe542c06 (diff)
downloadlibayatana-indicator-deccbbbcacf975b79d2a6586767dddd8d1962b14.tar.gz
libayatana-indicator-deccbbbcacf975b79d2a6586767dddd8d1962b14.tar.bz2
libayatana-indicator-deccbbbcacf975b79d2a6586767dddd8d1962b14.zip
indicator-applet (0.1.2-0ubuntu1) jaunty; urgency=low
* New upstream version * Removes duplicate prototypes (LP: #338885) * Fixes background color to match them on dark themes when the panel color is not set (LP: #334490) * Removing the handle and replacing it with the ability to right click on the applet to get a panel menu (LP: #339818) * Various build fixes -- Ted Gould <ted@ubuntu.com>Sun, 15 Mar 2009 08:58:20 -0500
Diffstat (limited to 'src')
-rw-r--r--src/applet-main.c83
1 files changed, 79 insertions, 4 deletions
diff --git a/src/applet-main.c b/src/applet-main.c
index 6efd33f..cd07548 100644
--- a/src/applet-main.c
+++ b/src/applet-main.c
@@ -83,6 +83,18 @@ load_module (const gchar * name, GtkWidget * menu)
}
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)
@@ -94,9 +106,69 @@ menubar_on_expose (GtkWidget * widget,
return FALSE;
}
+static void
+about_cb (BonoboUIComponent *ui_container,
+ gpointer data,
+ const gchar *cname)
+{
+ static const gchar *authors[] = {
+ "Ted Gould <ted@canonical.com>",
+ NULL
+ };
+
+ static gchar *license[] = {
+ N_("The Indicator Applet is free software; you can redistribute it and/or modify "
+ "it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation; either version 3 of the License."),
+ 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, write to the Free Software "
+ "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA "),
+ NULL
+ };
+ gchar *license_i18n;
+
+ license_i18n = g_strjoinv ("\n\n", license);
+
+ 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",
+ "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 =
+ "<popup name=\"button3\">"
+ "<menuitem name=\"About Item\" verb=\"IndicatorAppletAbout\" _label=\"" N_("_About") "\" pixtype=\"stock\" pixname=\"gtk-about\"/>"
+ "</popup>";
+
GtkWidget *menubar;
gint i;
gint indicators_loaded = 0;
@@ -109,12 +181,13 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data)
/* Set panel options */
gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
- panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR | PANEL_APPLET_HAS_HANDLE);
+ panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);
+ panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL);
/* 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);
+ /* g_debug("Icons directory: %s", ICONS_DIR); */
gtk_rc_parse_string (
"style \"indicator-applet-style\"\n"
"{\n"
@@ -123,12 +196,14 @@ applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data)
" GtkWidget::focus-line-width = 0\n"
" GtkWidget::focus-padding = 0\n"
"}\n"
- "widget \"*.indicator-applet-menubar\" style \"indicator-applet-style\"");
- gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar");
+ "widget \"*.fast-user-switch-applet\" style \"indicator-applet-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);
+ 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);