diff options
| -rw-r--r-- | configure.ac | 4 | ||||
| -rw-r--r-- | mate-dictionary/data/MATE_DictionaryApplet.server.in.in | 55 | ||||
| -rw-r--r-- | mate-dictionary/data/MATE_DictionaryApplet.xml | 15 | ||||
| -rw-r--r-- | mate-dictionary/data/Makefile.am | 40 | ||||
| -rw-r--r-- | mate-dictionary/data/dictionary-applet-menu.xml | 9 | ||||
| -rw-r--r-- | mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.in.in | 11 | ||||
| -rw-r--r-- | mate-dictionary/data/org.mate.panel.applet.DictionaryAppletFactory.service.in | 3 | ||||
| -rw-r--r-- | mate-dictionary/src/Makefile.am | 1 | ||||
| -rw-r--r-- | mate-dictionary/src/gdict-applet.c | 138 | 
9 files changed, 128 insertions, 148 deletions
| diff --git a/configure.ac b/configure.ac index 6a864180..c0b8f45f 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,7 @@ GLIB_REQUIRED=2.20.0  GIO_REQUIRED=2.16.0  GTK_REQUIRED=2.20.0  GIO_UNIX_REQUIRED=2.18.0 -LIBMATE_PANEL_APPLET_REQUIRED=1.1.0 +LIBMATE_PANEL_APPLET_REQUIRED=1.5.0  LIBGTOP_REQUIRED=2.12.0  LIBCANBERRA_GTK_REQUIRED=0.4 @@ -146,7 +146,7 @@ AS_CASE([$enable_gdict_applet],          [yes],          [            # Gdict applet checks -          PKG_CHECK_MODULES(APPLET, libmatepanelapplet-2.0 >= $LIBMATE_PANEL_APPLET_REQUIRED) +          PKG_CHECK_MODULES(APPLET, libmatepanelapplet-4.0 >= $LIBMATE_PANEL_APPLET_REQUIRED)            AC_SUBST(APPLET_LIBS)            AC_SUBST(APPLET_CFLAGS)          ], diff --git a/mate-dictionary/data/MATE_DictionaryApplet.server.in.in b/mate-dictionary/data/MATE_DictionaryApplet.server.in.in deleted file mode 100644 index 3c69076e..00000000 --- a/mate-dictionary/data/MATE_DictionaryApplet.server.in.in +++ /dev/null @@ -1,55 +0,0 @@ -<oaf_info> - -  <oaf_server iid="OAFIID:MATE_DictionaryApplet_Factory" -              type="exe" -              location="@LIBEXECDIR@/mate-dictionary-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="GDict Applet Factory"/> -        <oaf_attribute name="description" type="string" value="GDict Applet Factory"/> - -  </oaf_server> - -  <oaf_server iid="OAFIID:MATE_DictionaryApplet" -              type="factory" -              location="OAFIID:MATE_DictionaryApplet_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="name" type="string" _value="Dictionary Look up"/> -        <oaf_attribute name="description" type="string" _value="Look up words in a dictionary"/> -	<oaf_attribute name="panel:category" type="string" value="Accessories"/> -        <oaf_attribute name="panel:icon" type="string" value="accessories-dictionary.png"/> -	<oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> -	<oaf_attribute name="bugzilla:product" type="string" value="mate-utils"/> -	<oaf_attribute name="bugzilla:component" type="string" value="gdict-applet"/> -	<oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> -	<oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-dictionary-applet"/> - -  </oaf_server> - -  <oaf_server iid="OAFIID:MATE_GDictApplet" -              type="factory" -              location="OAFIID:MATE_DictionaryApplet_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="name" type="string" _value="Dictionary Look up"/> -        <oaf_attribute name="description" type="string" _value="Look up words in a dictionary"/> -        <oaf_attribute name="bugzilla:bugzilla" type="string" value="MATE"/> -        <oaf_attribute name="bugzilla:product" type="string" value="mate-utils"/> -        <oaf_attribute name="bugzilla:component" type="string" value="gdict-applet"/> -	<oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/> -        <oaf_attribute name="bugzilla:other_binaries" type="string" value="mate-dictionary-applet"/> -  </oaf_server> - -</oaf_info> diff --git a/mate-dictionary/data/MATE_DictionaryApplet.xml b/mate-dictionary/data/MATE_DictionaryApplet.xml deleted file mode 100644 index 3e975cc1..00000000 --- a/mate-dictionary/data/MATE_DictionaryApplet.xml +++ /dev/null @@ -1,15 +0,0 @@ -<Root> -  <popups> -    <popup name="button3"> -       <menuitem name="LookUpItem" verb="LookUp" _label="_Look Up Selected Text" pixtype="stock" pixname="gtk-find"/> -       <separator/> -       <menuitem name="ClearItem" verb="Clear" _label="Cl_ear" pixtype="stock" pixname="gtk-clear"/> -       <menuitem name="PrintItem" verb="Print" _label="_Print" pixtype="stock" pixname="gtk-print"/> -       <menuitem name="SaveItem" verb="Save" _label="_Save" pixtype="stock" pixname="gtk-save-as"/> -       <separator/> -       <menuitem name="PreferencesItem" verb="Preferences" _label="_Preferences" pixtype="stock" pixname="gtk-properties"/> -       <menuitem name="HelpItem" verb="Help" _label="_Help" pixtype="stock" pixname="gtk-help"/> -       <menuitem name="AboutItem" verb="About" _label="_About" pixtype="stock" pixname="gtk-about"/> -    </popup> -  </popups> -</Root> diff --git a/mate-dictionary/data/Makefile.am b/mate-dictionary/data/Makefile.am index 55f553df..5500b65d 100644 --- a/mate-dictionary/data/Makefile.am +++ b/mate-dictionary/data/Makefile.am @@ -32,21 +32,28 @@ ui_DATA = mate-dictionary-ui.xml  if BUILD_GDICT_APPLET -# applet menu definition -appletuidir = $(datadir)/mate-2.0/ui -appletui_DATA = MATE_DictionaryApplet.xml +# applet file, dbus service, and menu definition +appletdir = $(datadir)/mate-panel/applets +applet_in_files = org.mate.DictionaryApplet.mate-panel-applet.in +applet_DATA = $(applet_in_files:.mate-panel-applet.in=.mate-panel-applet) -serverdir = $(libdir)/matecomponent/servers -server_in_files = MATE_DictionaryApplet.server.in -server_DATA = $(server_in_files:.server.in=.server) +$(applet_in_files): $(applet_in_files).in Makefile +	$(AM_V_GEN)sed \ +		-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ +		$< > $@ -$(server_in_files): $(server_in_files:.server.in=.server.in.in) -	$(AM_V_GEN)sed 					\ -		-e "s|\@VERSION\@|@VERSION@|" 		\ -		-e "s|\@LIBEXECDIR\@|$(libexecdir)|" 	\ -	$< > $@ +%.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 -@INTLTOOL_SERVER_RULE@ +servicedir = $(datadir)/dbus-1/services +service_in_files = org.mate.panel.applet.DictionaryAppletFactory.service.in +service_DATA = $(service_in_files:.service.in=.service) + +org.mate.panel.applet.DictionaryAppletFactory.service: $(service_in_files) +	$(AM_V_GEN)sed \ +		-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ +		$< > $@ + +ui_DATA += dictionary-applet-menu.xml  endif # BUILD_GDICT_APPLET @@ -59,20 +66,21 @@ convertdir = $(datadir)/MateConf/gsettings  convert_DATA = mate-dictionary.convert  EXTRA_DIST = \ -	MATE_DictionaryApplet.server.in.in \ +	org.mate.DictionaryApplet.mate-panel-applet.in.in \ +	$(service_in_files) \  	mate-dictionary.desktop.in.in \  	$(dictsource_in_files) \  	$(man_MANS) \  	$(gsettingsschema_in_files) \  	$(builder_DATA) \  	$(ui_DATA) \ -	$(appletui_DATA) \  	$(NULL)  CLEANFILES = \ +	$(applet_DATA) \ +	$(applet_DATA).in \ +	$(service_DATA) \  	$(dictsource_DATA) \ -	$(server_in_files) \ -	$(server_DATA) \  	$(gdictapp_in_files) \  	$(gdictapp_DATA) \  	$(gsettings_SCHEMAS) \ diff --git a/mate-dictionary/data/dictionary-applet-menu.xml b/mate-dictionary/data/dictionary-applet-menu.xml new file mode 100644 index 00000000..b1b49335 --- /dev/null +++ b/mate-dictionary/data/dictionary-applet-menu.xml @@ -0,0 +1,9 @@ +<menuitem name="Dictionary Lookup Item" action="DictionaryLookup" /> +<separator/> +<menuitem name="Dictionary Clear Item" action="DictionaryClear" /> +<menuitem name="Dictionary Print Item" action="DictionaryPrint" /> +<menuitem name="Dictionary Save Item" action="DictionarySave" /> +<separator/> +<menuitem name="Dictionary Preferences Item" action="DictionaryPreferences" /> +<menuitem name="Dictionary Help Item" action="DictionaryHelp" /> +<menuitem name="Dictionary About Item" action="DictionaryAbout" /> diff --git a/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.in.in b/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.in.in new file mode 100644 index 00000000..ab8ecd82 --- /dev/null +++ b/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.in.in @@ -0,0 +1,11 @@ +[Applet Factory] +Id=DictionaryAppletFactory +Location=@LIBEXECDIR@/mate-dictionary-applet +_Name=Dictionary Applet Factory +_Description=Factory for the dictionary applet + +[DictionaryApplet] +_Name=Dictionary Look up +_Description=Look up words in a dictionary +Icon=accessories-dictionary +MateComponentId=OAFIID:MATE_DictionaryApplet diff --git a/mate-dictionary/data/org.mate.panel.applet.DictionaryAppletFactory.service.in b/mate-dictionary/data/org.mate.panel.applet.DictionaryAppletFactory.service.in new file mode 100644 index 00000000..c16b4127 --- /dev/null +++ b/mate-dictionary/data/org.mate.panel.applet.DictionaryAppletFactory.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.mate.panel.applet.DictionaryAppletFactory +Exec=@LIBEXECDIR@/mate-dictionary-applet diff --git a/mate-dictionary/src/Makefile.am b/mate-dictionary/src/Makefile.am index 57242f06..1a674e0f 100644 --- a/mate-dictionary/src/Makefile.am +++ b/mate-dictionary/src/Makefile.am @@ -5,7 +5,6 @@ INCLUDES = \  	-DSYSCONFDIR=\""$(sysconfdir)"\"		\  	-DLIBDIR=\""$(libdir)"\"			\  	-DDATADIR=\""$(datadir)"\" 			\ -	-DUIDATADIR=\""$(datadir)/mate-2.0/ui"\" 	\  	-DPKGDATADIR=\""$(datadir)/mate-dictionary"\" 	\  	-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \  	$(NULL) diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c index 3efb0d36..91a59fe3 100644 --- a/mate-dictionary/src/gdict-applet.c +++ b/mate-dictionary/src/gdict-applet.c @@ -78,6 +78,8 @@ struct _GdictAppletPrivate    GtkWidget *frame;    GtkWidget *defbox; +  GtkActionGroup* context_menu_action_group; +    guint idle_draw_id;    GdkPixbuf *icon; @@ -254,24 +256,19 @@ static void  gdict_applet_set_menu_items_sensitive (GdictApplet *applet,  				       gboolean     is_sensitive)  { -  MateComponentUIComponent *popup_component; -   -  popup_component = mate_panel_applet_get_popup_component (MATE_PANEL_APPLET (applet)); -  if (!MATECOMPONENT_IS_UI_COMPONENT (popup_component)) -    return; - -  matecomponent_ui_component_set_prop (popup_component, -		  		"/commands/Clear", -				"sensitive", (is_sensitive ? "1" : "0"), -				NULL); -  matecomponent_ui_component_set_prop (popup_component, -		  		"/commands/Print", -				"sensitive", (is_sensitive ? "1" : "0"), -				NULL); -  matecomponent_ui_component_set_prop (popup_component, -		  		"/commands/Save", -				"sensitive", (is_sensitive ? "1" : "0"), -				NULL); +  GtkAction *action; + +  action = gtk_action_group_get_action (applet->priv->context_menu_action_group, +                                        "DictionaryClear"); +  gtk_action_set_sensitive (action, is_sensitive); +  action = gtk_action_group_get_action (applet->priv->context_menu_action_group, +                                        "DictionaryPrint"); +  gtk_action_set_sensitive (action, is_sensitive); +  action = gtk_action_group_get_action (applet->priv->context_menu_action_group, +                                        "DictionarySave"); +  gtk_action_set_sensitive (action, is_sensitive); + +	return;  }  static gboolean @@ -670,9 +667,8 @@ gdict_applet_error_cb (GdictContext *context,  }  static void -gdict_applet_cmd_lookup (MateComponentUIComponent *component, -			 GdictApplet       *applet, -			 const gchar       *cname) +gdict_applet_cmd_lookup (GtkAction *action, +			 GdictApplet       *applet)  {    GdictAppletPrivate *priv = applet->priv;    gchar *text = NULL;; @@ -691,25 +687,29 @@ gdict_applet_cmd_lookup (MateComponentUIComponent *component,  }  static void -gdict_applet_cmd_clear (MateComponentUIComponent *component, -			GdictApplet       *applet, -			const gchar       *cname) +gdict_applet_cmd_clear (GtkAction *action, +			GdictApplet       *applet)  {    clear_cb (NULL, applet);  }  static void -gdict_applet_cmd_print (MateComponentUIComponent *component, -			GdictApplet       *applet, -			const gchar       *cname) +gdict_applet_cmd_print (GtkAction *action, +			GdictApplet       *applet)  {    print_cb (NULL, applet);  }  static void -gdict_applet_cmd_preferences (MateComponentUIComponent *component, -			      GdictApplet       *applet, -			      const gchar       *cname) +gdict_applet_cmd_save (GtkAction *action, +			GdictApplet       *applet) +{ +  save_cb (NULL, applet); +} + +static void +gdict_applet_cmd_preferences (GtkAction *action, +			      GdictApplet       *applet)  {    gdict_show_pref_dialog (GTK_WIDGET (applet),    			  _("Dictionary Preferences"), @@ -717,17 +717,15 @@ gdict_applet_cmd_preferences (MateComponentUIComponent *component,  }  static void -gdict_applet_cmd_about (MateComponentUIComponent *component, -			GdictApplet       *applet, -			const gchar       *cname) +gdict_applet_cmd_about (GtkAction *action, +			GdictApplet       *applet)  {    gdict_show_about_dialog (GTK_WIDGET (applet));  }  static void -gdict_applet_cmd_help (MateComponentUIComponent *component, -		       GdictApplet       *applet, -		       const gchar       *cname) +gdict_applet_cmd_help (GtkAction *action, +		       GdictApplet       *applet)  {    GError *err = NULL; @@ -1057,6 +1055,12 @@ gdict_applet_finalize (GObject *object)    if (priv->idle_draw_id)      g_source_remove (priv->idle_draw_id); +  if (priv->context_menu_action_group) +    { +      g_object_unref (priv->context_menu_action_group); +      priv->context_menu_action_group = NULL; +    } +    if (priv->settings != NULL)      {        g_object_unref (priv->settings); @@ -1186,18 +1190,28 @@ gdict_applet_init (GdictApplet *applet)  }  #ifndef GDICT_APPLET_STAND_ALONE -static const MateComponentUIVerb gdict_applet_menu_verbs[] = -{ -  MATECOMPONENT_UI_UNSAFE_VERB ("LookUp", gdict_applet_cmd_lookup), -   -  MATECOMPONENT_UI_UNSAFE_VERB ("Clear", gdict_applet_cmd_clear), -  MATECOMPONENT_UI_UNSAFE_VERB ("Print", gdict_applet_cmd_print), -   -  MATECOMPONENT_UI_UNSAFE_VERB ("Preferences", gdict_applet_cmd_preferences), -  MATECOMPONENT_UI_UNSAFE_VERB ("Help", gdict_applet_cmd_help), -  MATECOMPONENT_UI_UNSAFE_VERB ("About", gdict_applet_cmd_about), - -  MATECOMPONENT_UI_VERB_END +static const GtkActionEntry gdict_applet_menu_actions[] = { +  {"DictionaryLookup", GTK_STOCK_FIND, N_("_Look Up Selected Text"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_lookup) }, +  {"DictionaryClear", GTK_STOCK_CLEAR, N_("Cl_ear"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_clear) }, +  {"DictionaryPrint", GTK_STOCK_PRINT, N_("_Print"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_print) }, +  {"DictionarySave", GTK_STOCK_SAVE, N_("_Save"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_save) }, +  {"DictionaryPreferences", GTK_STOCK_PREFERENCES, N_("Preferences"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_preferences) }, +  {"DictionaryHelp", GTK_STOCK_HELP, N_("_Help"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_help) }, +  {"DictionaryAbout", GTK_STOCK_ABOUT, N_("_About"), +    NULL, NULL, +    G_CALLBACK (gdict_applet_cmd_about) },  };  static gboolean @@ -1206,22 +1220,29 @@ gdict_applet_factory (MatePanelApplet *applet,  		      gpointer     data)  {    gboolean retval = FALSE; +  gchar *ui_path; +  GdictApplet *dictionary_applet = GDICT_APPLET (applet); +  GdictAppletPrivate *priv = dictionary_applet->priv; -  if (((!strcmp (iid, "OAFIID:MATE_DictionaryApplet")) || -       (!strcmp (iid, "OAFIID:MATE_GDictApplet"))) && -      gdict_create_data_dir ()) +  if (((!strcmp (iid, "DictionaryApplet"))) && gdict_create_data_dir ())      {        /* Set up the menu */ -      mate_panel_applet_setup_menu_from_file (applet, UIDATADIR, -					 "MATE_DictionaryApplet.xml", -					 NULL, -					 gdict_applet_menu_verbs, -					 applet); +      priv->context_menu_action_group = gtk_action_group_new ("Dictionary Applet Actions"); +      gtk_action_group_set_translation_domain(priv->context_menu_action_group, +                                              GETTEXT_PACKAGE); +      gtk_action_group_add_actions(priv->context_menu_action_group, +								gdict_applet_menu_actions, +								G_N_ELEMENTS (gdict_applet_menu_actions), +								applet); +      ui_path = g_build_filename(PKGDATADIR, "dictionary-applet-menu.xml", NULL); +      mate_panel_applet_setup_menu_from_file (applet, ui_path, +                                              priv->context_menu_action_group); +      g_free (ui_path);        gtk_widget_show (GTK_WIDGET (applet));        /* set the menu items insensitive */ -      gdict_applet_set_menu_items_sensitive (GDICT_APPLET (applet), FALSE); +      gdict_applet_set_menu_items_sensitive (dictionary_applet, FALSE);        retval = TRUE;      } @@ -1230,10 +1251,9 @@ gdict_applet_factory (MatePanelApplet *applet,  }  /* this defines the main () for the applet */ -MATE_PANEL_APPLET_MATECOMPONENT_FACTORY ("OAFIID:MATE_DictionaryApplet_Factory", +MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("DictionaryAppletFactory",  			     GDICT_TYPE_APPLET,  			     "mate-dictionary-applet", -			     VERSION,  			     gdict_applet_factory,  			     NULL); | 
