diff options
Diffstat (limited to 'applets')
-rw-r--r-- | applets/brightness/MATE_BrightnessApplet.server.in.in | 36 | ||||
-rw-r--r-- | applets/brightness/MATE_BrightnessApplet.xml | 8 | ||||
-rw-r--r-- | applets/brightness/Makefile.am | 32 | ||||
-rw-r--r-- | applets/brightness/brightness-applet-menu.xml | 2 | ||||
-rw-r--r-- | applets/brightness/brightness-applet.c | 67 | ||||
-rw-r--r-- | applets/brightness/gpm-common.h | 6 | ||||
-rw-r--r-- | applets/brightness/org.mate.BrightnessApplet.mate-panel-applet.in.in | 16 | ||||
-rw-r--r-- | applets/brightness/org.mate.panel.applet.BrightnessAppletFactory.service.in | 3 | ||||
-rw-r--r-- | applets/inhibit/MATE_InhibitApplet.server.in.in | 36 | ||||
-rw-r--r-- | applets/inhibit/MATE_InhibitApplet.xml | 8 | ||||
-rw-r--r-- | applets/inhibit/Makefile.am | 31 | ||||
-rw-r--r-- | applets/inhibit/gpm-common.h | 6 | ||||
-rw-r--r-- | applets/inhibit/inhibit-applet-menu.xml | 2 | ||||
-rw-r--r-- | applets/inhibit/inhibit-applet.c | 67 | ||||
-rw-r--r-- | applets/inhibit/org.mate.InhibitApplet.mate-panel-applet.in.in | 16 | ||||
-rw-r--r-- | applets/inhibit/org.mate.panel.applet.InhibitAppletFactory.service.in | 3 |
16 files changed, 173 insertions, 166 deletions
diff --git a/applets/brightness/MATE_BrightnessApplet.server.in.in b/applets/brightness/MATE_BrightnessApplet.server.in.in deleted file mode 100644 index fcb60b7..0000000 --- a/applets/brightness/MATE_BrightnessApplet.server.in.in +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> - -<oaf_info> - <oaf_server iid="OAFIID:MATE_BrightnessApplet_Factory" type="exe" location="@LIBEXECDIR@/mate-brightness-applet"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:MateComponent/GenericFactory:1.0"/> - <item value="IDL:MateComponent/Unknown:1.0"/> - </oaf_attribute> - <oaf_attribute name="name" type="string" _value="Brightness Applet Factory"/> - <oaf_attribute name="description" type="string" _value="Factory for Brightness Applet"/> - <oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> - <oaf_attribute name="bugzilla:product" type="string" value="mate-power-manager"/> - <oaf_attribute name="bugzilla:component" type="string" value="applets"/> - <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> - <oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-brightness-applet"/> - </oaf_server> - <oaf_server iid="OAFIID:MATE_BrightnessApplet" type="factory" location="OAFIID:MATE_BrightnessApplet_Factory"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:MATE/Vertigo/MatePanelAppletShell:1.0"/> - <item value="IDL:MateComponent/Control:1.0"/> - <item value="IDL:MateComponent/Unknown:1.0"/> - </oaf_attribute> - <oaf_attribute name="panel:category" type="string" value="System & Hardware"/> - <oaf_attribute name="panel:icon" type="string" value="mate-brightness-applet"/> - <oaf_attribute name="name" type="string" _value="Brightness Applet"/> - <oaf_attribute name="description" type="string" _value="Adjusts Laptop panel brightness"/> - <oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> - <oaf_attribute name="bugzilla:product" type="string" value="mate-power-manager"/> - <oaf_attribute name="bugzilla:component" type="string" value="applets"/> - <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> - <oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-brightness-applet"/> - <oaf_attribute name="matecomponent:environment" type="stringv"> - <item value="DBUS_SESSION_BUS_ADDRESS"/> - </oaf_attribute> - </oaf_server> -</oaf_info> diff --git a/applets/brightness/MATE_BrightnessApplet.xml b/applets/brightness/MATE_BrightnessApplet.xml deleted file mode 100644 index 83b176f..0000000 --- a/applets/brightness/MATE_BrightnessApplet.xml +++ /dev/null @@ -1,8 +0,0 @@ -<Root> - <popups> - <popup name="button3"> - <menuitem name="Help" verb="Help" _label="_Help" pixtype="stock" pixname="gtk-help"/> - <menuitem name="About" verb="About" _label="_About" pixtype="stock" pixname="gtk-about" /> - </popup> - </popups> -</Root> diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am index c0a6cb6..781a6b0 100644 --- a/applets/brightness/Makefile.am +++ b/applets/brightness/Makefile.am @@ -14,6 +14,7 @@ INCLUDES = \ -DLIBDIR=\""$(libdir)"\" \ -DVERSION="\"$(VERSION)\"" \ -DGPM_DATA=\"$(pkgdatadir)\" \ + -DBRIGHTNESS_MENU_UI_DIR=\""$(uidir)"\" \ -DEGG_LOG_FILE=\""~/mate-power-manager.log"\" \ -DEGG_VERBOSE="\"GPM_VERBOSE\"" \ -DEGG_LOGGING="\"GPM_LOGGING\"" \ @@ -37,19 +38,32 @@ mate_brightness_applet_LDADD = \ $(MATE_LIBS) \ $(PANEL_LIBS) -serverdir = $(libdir)/matecomponent/servers -server_in_files = MATE_BrightnessApplet.server.in -server_DATA = $(server_in_files:.server.in=.server) -$(server_in_files): $(server_in_files:.server.in=.server.in.in) - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@ +appletdir = $(datadir)/mate-panel/applets +applet_in_files = org.mate.BrightnessApplet.mate-panel-applet.in +applet_DATA = $(applet_in_files:.mate-panel-applet.in=.mate-panel-applet) -@INTLTOOL_SERVER_RULE@ +$(applet_in_files): $(applet_in_files).in Makefile + $(AM_V_GEN)sed \ + -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ + -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \ + $< > $@ + +%.mate-panel-applet: %.mate-panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +servicedir = $(datadir)/dbus-1/services +service_in_files = org.mate.panel.applet.BrightnessAppletFactory.service.in +service_DATA = $(service_in_files:.service.in=.service) + +org.mate.panel.applet.BrightnessAppletFactory.service: $(service_in_files) + $(AM_V_GEN)sed \ + -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ + $< > $@ uidir = $(datadir)/mate-2.0/ui -ui_DATA = MATE_BrightnessApplet.xml +ui_DATA = brightness-applet-menu.xml -EXTRA_DIST = MATE_BrightnessApplet.server.in.in $(ui_DATA) +EXTRA_DIST = org.mate.BrightnessApplet.mate-panel-applet.in.in $(ui_DATA) $(service_in_files) DISTCLEANFILES = \ - $(server_DATA) $(server_DATA).in + $(applet_DATA) $(applet_DATA).in $(service_DATA) diff --git a/applets/brightness/brightness-applet-menu.xml b/applets/brightness/brightness-applet-menu.xml new file mode 100644 index 0000000..52d68e9 --- /dev/null +++ b/applets/brightness/brightness-applet-menu.xml @@ -0,0 +1,2 @@ +<menuitem name="Help" action="Help" /> +<menuitem name="About" action="About" /> diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c index 125af49..d516bdc 100644 --- a/applets/brightness/brightness-applet.c +++ b/applets/brightness/brightness-applet.c @@ -33,6 +33,7 @@ #include <string.h> #include <mate-panel-applet.h> #include <gtk/gtk.h> +#include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #include <glib-object.h> #include <dbus/dbus-glib.h> @@ -97,12 +98,12 @@ static gboolean gpm_applet_scroll_cb (GpmBrightnessApplet *applet, static gboolean gpm_applet_slide_cb (GtkWidget *w, GpmBrightnessApplet *applet); static void gpm_applet_create_popup (GpmBrightnessApplet *applet); static gboolean gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event); -static void gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname); -static gboolean gpm_applet_matecomponent_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data); +static void gpm_applet_dialog_about_cb (GtkAction *action, gpointer data); +static gboolean gpm_applet_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data); static void gpm_applet_destroy_cb (GtkObject *object); -#define GPM_BRIGHTNESS_APPLET_OAFID "OAFIID:MATE_BrightnessApplet" -#define GPM_BRIGHTNESS_APPLET_FACTORY_OAFID "OAFIID:MATE_BrightnessApplet_Factory" +#define GPM_BRIGHTNESS_APPLET_ID "BrightnessApplet" +#define GPM_BRIGHTNESS_APPLET_FACTORY_ID "BrightnessAppletFactory" #define GPM_BRIGHTNESS_APPLET_ICON "mate-brightness-applet" #define GPM_BRIGHTNESS_APPLET_ICON_DISABLED "gpm-brightness-lcd-disabled" #define GPM_BRIGHTNESS_APPLET_ICON_INVALID "gpm-brightness-lcd-invalid" @@ -731,7 +732,7 @@ gpm_applet_stop_scroll_events_cb (GtkWidget *widget, GdkEvent *event) * displays about dialog **/ static void -gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname) +gpm_applet_dialog_about_cb (GtkAction *action, gpointer data) { GtkAboutDialog *about; @@ -796,7 +797,7 @@ gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const * open gpm help **/ static void -gpm_applet_help_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname) +gpm_applet_help_cb (GtkAction *action, gpointer data) { gpm_help_display ("applets-brightness"); } @@ -995,44 +996,56 @@ gpm_brightness_applet_init (GpmBrightnessApplet *applet) } /** - * gpm_applet_matecomponent_cb: - * @_applet: GpmBrightnessApplet instance created by the matecomponent factory - * @iid: MateComponent id + * gpm_applet_cb: + * @_applet: GpmBrightnessApplet instance created by the applet factory + * @iid: Applet id * - * the function called by matecomponent factory after creation + * the function called by libmate-panel-applet factory after creation **/ static gboolean -gpm_applet_matecomponent_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data) +gpm_applet_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data) { GpmBrightnessApplet *applet = GPM_BRIGHTNESS_APPLET(_applet); - - static MateComponentUIVerb verbs [] = { - MATECOMPONENT_UI_VERB ("About", gpm_applet_dialog_about_cb), - MATECOMPONENT_UI_VERB ("Help", gpm_applet_help_cb), - MATECOMPONENT_UI_VERB_END + GtkActionGroup *action_group; + gchar *ui_path; + + static const GtkActionEntry menu_actions [] = { + { "About", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (gpm_applet_dialog_about_cb) }, + { "Help", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (gpm_applet_help_cb) } }; - if (strcmp (iid, GPM_BRIGHTNESS_APPLET_OAFID) != 0) { + if (strcmp (iid, GPM_BRIGHTNESS_APPLET_ID) != 0) { return FALSE; } - mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), - DATADIR, - "MATE_BrightnessApplet.xml", - NULL, verbs, applet); + action_group = gtk_action_group_new ("Brightness Applet Actions"); + gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); + gtk_action_group_add_actions (action_group, + menu_actions, + G_N_ELEMENTS (menu_actions), + applet); + ui_path = g_build_filename (BRIGHTNESS_MENU_UI_DIR, "brightness-applet-menu.xml", NULL); + mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), ui_path, action_group); + g_free (ui_path); + g_object_unref (action_group); + gpm_applet_draw_cb (applet); return TRUE; } /** - * this generates a main with a matecomponent factory + * this generates a main with a applet factory **/ -MATE_PANEL_APPLET_MATECOMPONENT_FACTORY +MATE_PANEL_APPLET_OUT_PROCESS_FACTORY (/* the factory iid */ - GPM_BRIGHTNESS_APPLET_FACTORY_OAFID, + GPM_BRIGHTNESS_APPLET_FACTORY_ID, /* generates brighness applets instead of regular mate applets */ GPM_TYPE_BRIGHTNESS_APPLET, - /* the applet name and version */ - "BrightnessApplet", VERSION, + /* the applet name */ + "BrightnessApplet", /* our callback (with no user data) */ - gpm_applet_matecomponent_cb, NULL); + gpm_applet_cb, NULL); diff --git a/applets/brightness/gpm-common.h b/applets/brightness/gpm-common.h index e2733a8..5a6d516 100644 --- a/applets/brightness/gpm-common.h +++ b/applets/brightness/gpm-common.h @@ -37,9 +37,9 @@ G_BEGIN_DECLS #define GPM_DESCRIPTION _("Power Manager for the MATE desktop") /* help location */ -#define GPM_HOMEPAGE_URL "http://www.mate.org/projects/mate-power-manager/" -#define GPM_BUGZILLA_URL "http://bugzilla.mate.org/buglist.cgi?product=mate-power-manager" -#define GPM_FAQ_URL "http://live.mate.org/MatePowerManager/Faq" +#define GPM_HOMEPAGE_URL "http://www.mate-desktop.org/" +#define GPM_BUGZILLA_URL "https://github.com/mate-desktop/mate-power-manager/issues" +#define GPM_FAQ_URL "http://wiki.mate-desktop.org/" /* change general/installed_schema whenever adding or moving keys */ #define GPM_CONF_SCHEMA_ID 3 diff --git a/applets/brightness/org.mate.BrightnessApplet.mate-panel-applet.in.in b/applets/brightness/org.mate.BrightnessApplet.mate-panel-applet.in.in new file mode 100644 index 0000000..3a3a0a8 --- /dev/null +++ b/applets/brightness/org.mate.BrightnessApplet.mate-panel-applet.in.in @@ -0,0 +1,16 @@ +[Applet Factory] +Id=BrightnessAppletFactory +Location=@LIBEXECDIR@/mate-brightness-applet +_Name=Brightness Applet Factory +_Description=Factory for Brightness Applet + +[BrightnessApplet] +_Name=Brightness Applet +_Description=Adjusts Laptop panel brightness +Icon=mate-brightness-applet +MateComponentId=OAFIID:MATE_BrightnessApplet +X-MATE-Bugzilla-Bugzilla=MATE +X-MATE-Bugzilla-Product=mate-power-manager +X-MATE-Bugzilla-Component=applets +X-MATE-Bugzilla-Version=@VERSION@ +X-MATE-Bugzilla-OtherBinaries=mate-brightness-applet diff --git a/applets/brightness/org.mate.panel.applet.BrightnessAppletFactory.service.in b/applets/brightness/org.mate.panel.applet.BrightnessAppletFactory.service.in new file mode 100644 index 0000000..596a2d6 --- /dev/null +++ b/applets/brightness/org.mate.panel.applet.BrightnessAppletFactory.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.mate.panel.applet.BrightnessAppletFactory +Exec=@LIBEXECDIR@/mate-brightness-applet diff --git a/applets/inhibit/MATE_InhibitApplet.server.in.in b/applets/inhibit/MATE_InhibitApplet.server.in.in deleted file mode 100644 index d65c077..0000000 --- a/applets/inhibit/MATE_InhibitApplet.server.in.in +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> - -<oaf_info> - <oaf_server iid="OAFIID:MATE_InhibitApplet_Factory" type="exe" location="@LIBEXECDIR@/mate-inhibit-applet"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:MateComponent/GenericFactory:1.0"/> - <item value="IDL:MateComponent/Unknown:1.0"/> - </oaf_attribute> - <oaf_attribute name="name" type="string" _value="Inhibit Applet Factory"/> - <oaf_attribute name="description" type="string" _value="Factory for Inhibit Applet"/> - <oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> - <oaf_attribute name="bugzilla:product" type="string" value="mate-power-manager"/> - <oaf_attribute name="bugzilla:component" type="string" value="applets"/> - <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> - <oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-inhibit-applet"/> - <oaf_attribute name="matecomponent:environment" type="stringv"> - <item value="DBUS_SESSION_BUS_ADDRESS"/> - </oaf_attribute> - </oaf_server> - <oaf_server iid="OAFIID:MATE_InhibitApplet" type="factory" location="OAFIID:MATE_InhibitApplet_Factory"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:MATE/Vertigo/MatePanelAppletShell:1.0"/> - <item value="IDL:MateComponent/Control:1.0"/> - <item value="IDL:MateComponent/Unknown:1.0"/> - </oaf_attribute> - <oaf_attribute name="panel:category" type="string" value="System & Hardware"/> - <oaf_attribute name="panel:icon" type="string" value="mate-inhibit-applet"/> - <oaf_attribute name="name" type="string" _value="Inhibit Applet"/> - <oaf_attribute name="description" type="string" _value="Allows user to inhibit automatic power saving"/> - <oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> - <oaf_attribute name="bugzilla:product" type="string" value="mate-power-manager"/> - <oaf_attribute name="bugzilla:component" type="string" value="applets"/> - <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> - <oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-inhibit-applet"/> - </oaf_server> -</oaf_info> diff --git a/applets/inhibit/MATE_InhibitApplet.xml b/applets/inhibit/MATE_InhibitApplet.xml deleted file mode 100644 index 83b176f..0000000 --- a/applets/inhibit/MATE_InhibitApplet.xml +++ /dev/null @@ -1,8 +0,0 @@ -<Root> - <popups> - <popup name="button3"> - <menuitem name="Help" verb="Help" _label="_Help" pixtype="stock" pixname="gtk-help"/> - <menuitem name="About" verb="About" _label="_About" pixtype="stock" pixname="gtk-about" /> - </popup> - </popups> -</Root> diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am index fb42774..37f5d6c 100644 --- a/applets/inhibit/Makefile.am +++ b/applets/inhibit/Makefile.am @@ -14,6 +14,7 @@ INCLUDES = \ -DLIBDIR=\""$(libdir)"\" \ -DVERSION="\"$(VERSION)\"" \ -DGPM_DATA=\"$(pkgdatadir)\" \ + -DINHIBIT_MENU_UI_DIR=\""$(uidir)"\" \ -DEGG_LOG_FILE=\""~/mate-power-manager.log"\" \ -DEGG_VERBOSE="\"GPM_VERBOSE\"" \ -DEGG_LOGGING="\"GPM_LOGGING\"" \ @@ -37,19 +38,31 @@ mate_inhibit_applet_LDADD = \ $(MATE_LIBS) \ $(PANEL_LIBS) -serverdir = $(libdir)/matecomponent/servers -server_in_files = MATE_InhibitApplet.server.in -server_DATA = $(server_in_files:.server.in=.server) +appletdir = $(datadir)/mate-panel/applets +applet_in_files = org.mate.InhibitApplet.mate-panel-applet.in +applet_DATA = $(applet_in_files:.mate-panel-applet.in=.mate-panel-applet) -$(server_in_files): $(server_in_files:.server.in=.server.in.in) - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@ +$(applet_in_files): $(applet_in_files).in Makefile + $(AM_V_GEN)sed \ + -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ + -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \ + $< > $@ -@INTLTOOL_SERVER_RULE@ +%.mate-panel-applet: %.mate-panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache + +servicedir = $(datadir)/dbus-1/services +service_in_files = org.mate.panel.applet.InhibitAppletFactory.service.in +service_DATA = $(service_in_files:.service.in=.service) + +org.mate.panel.applet.InhibitAppletFactory.service: $(service_in_files) + $(AM_V_GEN)sed \ + -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ + $< > $@ uidir = $(datadir)/mate-2.0/ui -ui_DATA = MATE_InhibitApplet.xml +ui_DATA = inhibit-applet-menu.xml -EXTRA_DIST = MATE_InhibitApplet.server.in.in $(ui_DATA) +EXTRA_DIST = org.mate.InhibitApplet.mate-panel-applet.in.in $(ui_DATA) $(service_in_files) DISTCLEANFILES = \ - $(server_DATA) $(server_DATA).in + $(applet_DATA) $(applet_DATA).in $(server_DATA) diff --git a/applets/inhibit/gpm-common.h b/applets/inhibit/gpm-common.h index e2733a8..5a6d516 100644 --- a/applets/inhibit/gpm-common.h +++ b/applets/inhibit/gpm-common.h @@ -37,9 +37,9 @@ G_BEGIN_DECLS #define GPM_DESCRIPTION _("Power Manager for the MATE desktop") /* help location */ -#define GPM_HOMEPAGE_URL "http://www.mate.org/projects/mate-power-manager/" -#define GPM_BUGZILLA_URL "http://bugzilla.mate.org/buglist.cgi?product=mate-power-manager" -#define GPM_FAQ_URL "http://live.mate.org/MatePowerManager/Faq" +#define GPM_HOMEPAGE_URL "http://www.mate-desktop.org/" +#define GPM_BUGZILLA_URL "https://github.com/mate-desktop/mate-power-manager/issues" +#define GPM_FAQ_URL "http://wiki.mate-desktop.org/" /* change general/installed_schema whenever adding or moving keys */ #define GPM_CONF_SCHEMA_ID 3 diff --git a/applets/inhibit/inhibit-applet-menu.xml b/applets/inhibit/inhibit-applet-menu.xml new file mode 100644 index 0000000..52d68e9 --- /dev/null +++ b/applets/inhibit/inhibit-applet-menu.xml @@ -0,0 +1,2 @@ +<menuitem name="Help" action="Help" /> +<menuitem name="About" action="About" /> diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c index e976c60..3f70ec4 100644 --- a/applets/inhibit/inhibit-applet.c +++ b/applets/inhibit/inhibit-applet.c @@ -34,6 +34,7 @@ #include <mate-panel-applet.h> #include <gtk/gtk.h> #include <glib-object.h> +#include <glib/gi18n.h> #include <dbus/dbus-glib.h> #include "egg-debug.h" @@ -83,12 +84,12 @@ static void gpm_applet_check_size (GpmInhibitApplet *applet); static gboolean gpm_applet_draw_cb (GpmInhibitApplet *applet); static void gpm_applet_update_tooltip (GpmInhibitApplet *applet); static gboolean gpm_applet_click_cb (GpmInhibitApplet *applet, GdkEventButton *event); -static void gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname); -static gboolean gpm_applet_matecomponent_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data); +static void gpm_applet_dialog_about_cb (GtkAction *action, gpointer data); +static gboolean gpm_applet_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data); static void gpm_applet_destroy_cb (GtkObject *object); -#define GPM_INHIBIT_APPLET_OAFID "OAFIID:MATE_InhibitApplet" -#define GPM_INHIBIT_APPLET_FACTORY_OAFID "OAFIID:MATE_InhibitApplet_Factory" +#define GPM_INHIBIT_APPLET_ID "InhibitApplet" +#define GPM_INHIBIT_APPLET_FACTORY_ID "InhibitAppletFactory" #define GPM_INHIBIT_APPLET_ICON_INHIBIT "gpm-inhibit" #define GPM_INHIBIT_APPLET_ICON_INVALID "gpm-inhibit-invalid" #define GPM_INHIBIT_APPLET_ICON_UNINHIBIT "gpm-hibernate" @@ -410,7 +411,7 @@ gpm_applet_click_cb (GpmInhibitApplet *applet, GdkEventButton *event) * displays about dialog **/ static void -gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname) +gpm_applet_dialog_about_cb (GtkAction *action, gpointer data) { GtkAboutDialog *about; @@ -475,7 +476,7 @@ gpm_applet_dialog_about_cb (MateComponentUIComponent *uic, gpointer data, const * open gpm help **/ static void -gpm_applet_help_cb (MateComponentUIComponent *uic, gpointer data, const gchar *verbname) +gpm_applet_help_cb (GtkAction *action, gpointer data) { gpm_help_display ("applets-inhibit"); } @@ -645,44 +646,56 @@ gpm_inhibit_applet_init (GpmInhibitApplet *applet) } /** - * gpm_applet_matecomponent_cb: - * @_applet: GpmInhibitApplet instance created by the matecomponent factory - * @iid: MateComponent id + * gpm_applet_cb: + * @_applet: GpmInhibitApplet instance created by the applet factory + * @iid: Applet id * - * the function called by matecomponent factory after creation + * the function called by libmate-panel-applet factory after creation **/ static gboolean -gpm_applet_matecomponent_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data) +gpm_applet_cb (MatePanelApplet *_applet, const gchar *iid, gpointer data) { GpmInhibitApplet *applet = GPM_INHIBIT_APPLET(_applet); - - static MateComponentUIVerb verbs [] = { - MATECOMPONENT_UI_VERB ("About", gpm_applet_dialog_about_cb), - MATECOMPONENT_UI_VERB ("Help", gpm_applet_help_cb), - MATECOMPONENT_UI_VERB_END + GtkActionGroup *action_group; + gchar *ui_path; + + static const GtkActionEntry menu_actions [] = { + { "About", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (gpm_applet_dialog_about_cb) }, + { "Help", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (gpm_applet_help_cb) } }; - if (strcmp (iid, GPM_INHIBIT_APPLET_OAFID) != 0) { + if (strcmp (iid, GPM_INHIBIT_APPLET_ID) != 0) { return FALSE; } - mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), - DATADIR, - "MATE_InhibitApplet.xml", - NULL, verbs, applet); + action_group = gtk_action_group_new ("Inhibit Applet Actions"); + gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); + gtk_action_group_add_actions (action_group, + menu_actions, + G_N_ELEMENTS (menu_actions), + applet); + ui_path = g_build_filename (INHIBIT_MENU_UI_DIR, "inhibit-applet-menu.xml", NULL); + mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), ui_path, action_group); + g_free (ui_path); + g_object_unref (action_group); + gpm_applet_draw_cb (applet); return TRUE; } /** - * this generates a main with a matecomponent factory + * this generates a main with a applet factory **/ -MATE_PANEL_APPLET_MATECOMPONENT_FACTORY +MATE_PANEL_APPLET_OUT_PROCESS_FACTORY (/* the factory iid */ - GPM_INHIBIT_APPLET_FACTORY_OAFID, + GPM_INHIBIT_APPLET_FACTORY_ID, /* generates brighness applets instead of regular mate applets */ GPM_TYPE_INHIBIT_APPLET, - /* the applet name and version */ - "InhibitApplet", VERSION, + /* the applet name */ + "InhibitApplet", /* our callback (with no user data) */ - gpm_applet_matecomponent_cb, NULL); + gpm_applet_cb, NULL) diff --git a/applets/inhibit/org.mate.InhibitApplet.mate-panel-applet.in.in b/applets/inhibit/org.mate.InhibitApplet.mate-panel-applet.in.in new file mode 100644 index 0000000..d65060b --- /dev/null +++ b/applets/inhibit/org.mate.InhibitApplet.mate-panel-applet.in.in @@ -0,0 +1,16 @@ +[Applet Factory] +Id=InhibitAppletFactory +Location=@LIBEXECDIR@/mate-inhibit-applet +_Name=Inhibit Applet Factory +_Description=Factory for Inhibit Applet + +[InhibitApplet] +_Name=Inhibit Applet +_Description=Allows user to inhibit automatic power saving +Icon=mate-inhibit-applet +MateComponentId=OAFIID:MATE_InhibitApplet +X-MATE-Bugzilla-Bugzilla=MATE +X-MATE-Bugzilla-Product=mate-power-manager +X-MATE-Bugzilla-Component=applets +X-MATE-Bugzilla-Version=@VERSION@ +X-MATE-Bugzilla-OtherBinaries=mate-inhibit-applet diff --git a/applets/inhibit/org.mate.panel.applet.InhibitAppletFactory.service.in b/applets/inhibit/org.mate.panel.applet.InhibitAppletFactory.service.in new file mode 100644 index 0000000..5fd8ccb --- /dev/null +++ b/applets/inhibit/org.mate.panel.applet.InhibitAppletFactory.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.mate.panel.applet.InhibitAppletFactory +Exec=@LIBEXECDIR@/mate-inhibit-applet |