[gnome-applets/wip/segeiger/in-process] trash: convert to in-process applet



commit 4c5f00c0197ec61f486b012f2b4c768bf84f8a7a
Author: Sebastian Geiger <sbastig gmx net>
Date:   Tue Jul 26 23:11:33 2016 +0200

    trash: convert to in-process applet
    
    DRAFT - NOT TESTED

 trash/Makefile.am                                  |    3 +
 {trashapplet => trash}/README                      |    0
 trash/data/Makefile.am                             |   28 +++++++++++
 ...rg.gnome.applets.TrashApplet.panel-applet.in.in |    3 +-
 .../help/C/figures/trash-applet.png                |  Bin 10656 -> 10656 bytes
 {trashapplet => trash}/help/C/index.docbook        |    0
 {trashapplet => trash}/help/C/legal.xml            |    0
 {trashapplet => trash}/help/Makefile.am            |    0
 {trashapplet => trash}/help/ca/ca.po               |    0
 {trashapplet => trash}/help/cs/cs.po               |    0
 {trashapplet => trash}/help/da/da.po               |    0
 {trashapplet => trash}/help/de/de.po               |    0
 .../help/de/figures/trash-applet.png               |  Bin 12858 -> 12858 bytes
 {trashapplet => trash}/help/el/el.po               |    0
 .../help/el/figures/trash-applet.png               |  Bin 13302 -> 13302 bytes
 {trashapplet => trash}/help/en_GB/en_GB.po         |    0
 {trashapplet => trash}/help/es/es.po               |    0
 .../help/es/figures/trash-applet.png               |  Bin 9913 -> 9913 bytes
 {trashapplet => trash}/help/eu/eu.po               |    0
 .../help/eu/figures/trash-applet.png               |  Bin 8722 -> 8722 bytes
 {trashapplet => trash}/help/fi/fi.po               |    0
 .../help/fi/figures/trash-applet.png               |  Bin 11544 -> 11544 bytes
 .../help/fr/figures/trash-applet.png               |  Bin 11615 -> 11615 bytes
 {trashapplet => trash}/help/fr/fr.po               |    0
 {trashapplet => trash}/help/hu/hu.po               |    0
 .../help/it/figures/trash-applet.png               |  Bin 10630 -> 10630 bytes
 {trashapplet => trash}/help/it/it.po               |    0
 {trashapplet => trash}/help/mk/mk.po               |    0
 .../help/nl/figures/trash-applet.png               |  Bin 10656 -> 10656 bytes
 {trashapplet => trash}/help/nl/nl.po               |    0
 {trashapplet => trash}/help/oc/oc.po               |    0
 .../help/pa/figures/trash-applet.png               |  Bin 19701 -> 19701 bytes
 {trashapplet => trash}/help/pa/pa.po               |    0
 {trashapplet => trash}/help/pt_BR/pt_BR.po         |    0
 {trashapplet => trash}/help/ro/ro.po               |    0
 {trashapplet => trash}/help/ru/ru.po               |    0
 {trashapplet => trash}/help/sl/sl.po               |    0
 .../help/sv/figures/trash-applet.png               |  Bin 9920 -> 9920 bytes
 {trashapplet => trash}/help/sv/sv.po               |    0
 .../help/uk/figures/trash-applet.png               |  Bin 10401 -> 10401 bytes
 {trashapplet => trash}/help/uk/uk.po               |    0
 {trashapplet => trash}/help/zh_CN/zh_CN.po         |    0
 {trashapplet => trash}/help/zh_HK/zh_HK.po         |    0
 {trashapplet => trash}/help/zh_TW/zh_TW.po         |    0
 trash/src/Makefile.am                              |   52 ++++++++++++++++++++
 .../src/trashapplet.c => trash/src/trash-applet.c  |   22 +++++---
 .../src/trashapplet.h => trash/src/trash-applet.h  |    0
 {trashapplet => trash}/src/trash-empty.c           |    8 ++-
 {trashapplet => trash}/src/trash-empty.h           |    0
 .../src/trash-empty.ui                             |    0
 .../src/trash-menu.xml                             |    0
 trash/src/trash-resources.gresource.xml            |    7 +++
 trashapplet/Makefile.am                            |   38 --------------
 ...nome.panel.applet.TrashAppletFactory.service.in |    3 -
 trashapplet/src/Makefile.am                        |   31 ------------
 55 files changed, 110 insertions(+), 85 deletions(-)
---
diff --git a/trash/Makefile.am b/trash/Makefile.am
new file mode 100644
index 0000000..9591889
--- /dev/null
+++ b/trash/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = help src
+
+-include $(top_srcdir)/git.mk
diff --git a/trashapplet/README b/trash/README
similarity index 100%
rename from trashapplet/README
rename to trash/README
diff --git a/trash/data/Makefile.am b/trash/data/Makefile.am
new file mode 100644
index 0000000..e6c840b
--- /dev/null
+++ b/trash/data/Makefile.am
@@ -0,0 +1,28 @@
+NULL =
+
+appletdir       = $(LIBPANEL_APPLET_DIR)
+applet_in_files = org.gnome.applets.TrashApplet.panel-applet.in
+applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)
+
+APPLET_LOCATION=$(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)/libtrash-applet.so
+
+$(applet_in_files): $(applet_in_files).in Makefile
+       $(AM_V_GEN)sed \
+       -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
+       -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
+       $< > $@
+
+@INTLTOOL_XML_NOMERGE_RULE@
+
+%.panel-applet: %.panel-applet.in \
+       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; \
+       $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+EXTRA_DIST = \
+       org.gnome.applets.WindowPicker.panel-applet.in.in \
+       $(NULL)
+
+CLEANFILES = \
+       $(applet_DATA) \
+       $(applet_DATA).in \
+       $(NULL)
diff --git a/trashapplet/org.gnome.applets.TrashApplet.panel-applet.in.in 
b/trash/data/org.gnome.applets.TrashApplet.panel-applet.in.in
similarity index 89%
rename from trashapplet/org.gnome.applets.TrashApplet.panel-applet.in.in
rename to trash/data/org.gnome.applets.TrashApplet.panel-applet.in.in
index b57bfba..7fa2ef7 100644
--- a/trashapplet/org.gnome.applets.TrashApplet.panel-applet.in.in
+++ b/trash/data/org.gnome.applets.TrashApplet.panel-applet.in.in
@@ -1,6 +1,7 @@
 [Applet Factory]
 Id=TrashAppletFactory
-Location=@LIBEXECDIR@/trashapplet
+Location=@APPLET_LOCATION@
+InProcess=true
 Name=Trash Applet Factory
 Description=Trash Applet Factory
 
diff --git a/trashapplet/help/C/index.docbook b/trash/help/C/index.docbook
similarity index 100%
rename from trashapplet/help/C/index.docbook
rename to trash/help/C/index.docbook
diff --git a/trashapplet/help/C/legal.xml b/trash/help/C/legal.xml
similarity index 100%
rename from trashapplet/help/C/legal.xml
rename to trash/help/C/legal.xml
diff --git a/trashapplet/help/Makefile.am b/trash/help/Makefile.am
similarity index 100%
rename from trashapplet/help/Makefile.am
rename to trash/help/Makefile.am
diff --git a/trashapplet/help/ca/ca.po b/trash/help/ca/ca.po
similarity index 100%
rename from trashapplet/help/ca/ca.po
rename to trash/help/ca/ca.po
diff --git a/trashapplet/help/cs/cs.po b/trash/help/cs/cs.po
similarity index 100%
rename from trashapplet/help/cs/cs.po
rename to trash/help/cs/cs.po
diff --git a/trashapplet/help/da/da.po b/trash/help/da/da.po
similarity index 100%
rename from trashapplet/help/da/da.po
rename to trash/help/da/da.po
diff --git a/trashapplet/help/de/de.po b/trash/help/de/de.po
similarity index 100%
rename from trashapplet/help/de/de.po
rename to trash/help/de/de.po
diff --git a/trashapplet/help/el/el.po b/trash/help/el/el.po
similarity index 100%
rename from trashapplet/help/el/el.po
rename to trash/help/el/el.po
diff --git a/trashapplet/help/en_GB/en_GB.po b/trash/help/en_GB/en_GB.po
similarity index 100%
rename from trashapplet/help/en_GB/en_GB.po
rename to trash/help/en_GB/en_GB.po
diff --git a/trashapplet/help/es/es.po b/trash/help/es/es.po
similarity index 100%
rename from trashapplet/help/es/es.po
rename to trash/help/es/es.po
diff --git a/trashapplet/help/eu/eu.po b/trash/help/eu/eu.po
similarity index 100%
rename from trashapplet/help/eu/eu.po
rename to trash/help/eu/eu.po
diff --git a/trashapplet/help/fi/fi.po b/trash/help/fi/fi.po
similarity index 100%
rename from trashapplet/help/fi/fi.po
rename to trash/help/fi/fi.po
diff --git a/trashapplet/help/fr/fr.po b/trash/help/fr/fr.po
similarity index 100%
rename from trashapplet/help/fr/fr.po
rename to trash/help/fr/fr.po
diff --git a/trashapplet/help/hu/hu.po b/trash/help/hu/hu.po
similarity index 100%
rename from trashapplet/help/hu/hu.po
rename to trash/help/hu/hu.po
diff --git a/trashapplet/help/it/it.po b/trash/help/it/it.po
similarity index 100%
rename from trashapplet/help/it/it.po
rename to trash/help/it/it.po
diff --git a/trashapplet/help/mk/mk.po b/trash/help/mk/mk.po
similarity index 100%
rename from trashapplet/help/mk/mk.po
rename to trash/help/mk/mk.po
diff --git a/trashapplet/help/nl/nl.po b/trash/help/nl/nl.po
similarity index 100%
rename from trashapplet/help/nl/nl.po
rename to trash/help/nl/nl.po
diff --git a/trashapplet/help/oc/oc.po b/trash/help/oc/oc.po
similarity index 100%
rename from trashapplet/help/oc/oc.po
rename to trash/help/oc/oc.po
diff --git a/trashapplet/help/pa/pa.po b/trash/help/pa/pa.po
similarity index 100%
rename from trashapplet/help/pa/pa.po
rename to trash/help/pa/pa.po
diff --git a/trashapplet/help/pt_BR/pt_BR.po b/trash/help/pt_BR/pt_BR.po
similarity index 100%
rename from trashapplet/help/pt_BR/pt_BR.po
rename to trash/help/pt_BR/pt_BR.po
diff --git a/trashapplet/help/ro/ro.po b/trash/help/ro/ro.po
similarity index 100%
rename from trashapplet/help/ro/ro.po
rename to trash/help/ro/ro.po
diff --git a/trashapplet/help/ru/ru.po b/trash/help/ru/ru.po
similarity index 100%
rename from trashapplet/help/ru/ru.po
rename to trash/help/ru/ru.po
diff --git a/trashapplet/help/sl/sl.po b/trash/help/sl/sl.po
similarity index 100%
rename from trashapplet/help/sl/sl.po
rename to trash/help/sl/sl.po
diff --git a/trashapplet/help/sv/sv.po b/trash/help/sv/sv.po
similarity index 100%
rename from trashapplet/help/sv/sv.po
rename to trash/help/sv/sv.po
diff --git a/trashapplet/help/uk/uk.po b/trash/help/uk/uk.po
similarity index 100%
rename from trashapplet/help/uk/uk.po
rename to trash/help/uk/uk.po
diff --git a/trashapplet/help/zh_CN/zh_CN.po b/trash/help/zh_CN/zh_CN.po
similarity index 100%
rename from trashapplet/help/zh_CN/zh_CN.po
rename to trash/help/zh_CN/zh_CN.po
diff --git a/trashapplet/help/zh_HK/zh_HK.po b/trash/help/zh_HK/zh_HK.po
similarity index 100%
rename from trashapplet/help/zh_HK/zh_HK.po
rename to trash/help/zh_HK/zh_HK.po
diff --git a/trashapplet/help/zh_TW/zh_TW.po b/trash/help/zh_TW/zh_TW.po
similarity index 100%
rename from trashapplet/help/zh_TW/zh_TW.po
rename to trash/help/zh_TW/zh_TW.po
diff --git a/trash/src/Makefile.am b/trash/src/Makefile.am
new file mode 100644
index 0000000..33f47de
--- /dev/null
+++ b/trash/src/Makefile.am
@@ -0,0 +1,52 @@
+NULL =
+
+trash_libdir=${pkglibdir}/${LIBPANEL_APPLET_API_VERSION}
+trash_lib_LTLIBRARIES=libtrash-applet.la
+
+libtrash_applet_CFLAGS = \
+       -DGNOMELOCALEDIR=\""$(localedir)"\" \
+       -I$(top_builddir) \
+       -I$(top_srcdir) \
+       $(GNOME_APPLETS_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GCC_FLAGS) \
+       $(WARN_CFLAGS) \
+       $(AM_CFLAGS) \
+       $(NULL)
+
+libtrash_applet_LDFLAGS = \
+       -module -avoid-version \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
+
+libtrash_applet_LIBADD = \
+       $(GNOME_APPLETS_LIBS) \
+       $(GIO_LIBS) \
+       $(X_LIBS) \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
+
+trashapplet_SOURCES = \
+       trash-applet.c \
+       trash-applet.h \
+       trash-empty.h \
+       trash-empty.c \
+       trash-resources.c \
+       trash-resources.h \
+       $(NULL)
+
+trash-resources.c: trash-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/trash-resources.gresource.xml)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name trash $<
+
+trash-resources.h: trash-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/trash-resources.gresource.xml)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name trash $<
+
+EXTRA_DIST = \
+       trash-menu.xml \
+       trash-empty.ui \
+       trash-resources.gresource.xml \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/trashapplet/src/trashapplet.c b/trash/src/trash-applet.c
similarity index 96%
rename from trashapplet/src/trashapplet.c
rename to trash/src/trash-applet.c
index 6cf9b72..63ec003 100644
--- a/trashapplet/src/trashapplet.c
+++ b/trash/src/trash-applet.c
@@ -34,6 +34,8 @@
 
 #include "trash-empty.h"
 
+#define GRESOURCE "/org/gnome/gnome-applets/trash/"
+
 typedef PanelAppletClass TrashAppletClass;
 
 typedef struct
@@ -376,7 +378,7 @@ trash_applet_show_help (GSimpleAction *action,
 
   /* FIXME - Actually, we need a user guide */
   gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (applet)),
-                "help:trashapplet",
+                "help:trash",
                 gtk_get_current_event_time (),
                 &err);
 
@@ -599,7 +601,7 @@ trash_applet_factory (PanelApplet *applet,
   if (!strcmp (iid, "TrashApplet"))
     {
       GSimpleActionGroup *action_group;
-      gchar          *ui_path;
+      const gchar          *resource_name;
 
       g_set_application_name (_("Trash Applet"));
 
@@ -611,9 +613,11 @@ trash_applet_factory (PanelApplet *applet,
                                        trash_applet_menu_actions,
                                        G_N_ELEMENTS (trash_applet_menu_actions),
                                        applet);
-      ui_path = g_build_filename (TRASH_MENU_UI_DIR, "trashapplet-menu.xml", NULL);
-      panel_applet_setup_menu_from_file (applet, ui_path, action_group, GETTEXT_PACKAGE);
-      g_free (ui_path);
+      resource_name = GRESOURCE "trash-menu.xml";
+      panel_applet_setup_menu_from_resource (applet,
+                                             resource_name,
+                                             action_group,
+                                             GETTEXT_PACKAGE);
 
       gtk_widget_insert_action_group (GTK_WIDGET (applet), "trash",
                                       G_ACTION_GROUP (action_group));
@@ -628,7 +632,7 @@ trash_applet_factory (PanelApplet *applet,
   return retval;
 }
 
-PANEL_APPLET_OUT_PROCESS_FACTORY ("TrashAppletFactory",
-                                 TRASH_TYPE_APPLET,
-                                 trash_applet_factory,
-                                 NULL)
+PANEL_APPLET_IN_PROCESS_FACTORY ("TrashAppletFactory",
+                                 TRASH_TYPE_APPLET,
+                                 trash_applet_factory,
+                                 NULL)
diff --git a/trashapplet/src/trashapplet.h b/trash/src/trash-applet.h
similarity index 100%
rename from trashapplet/src/trashapplet.h
rename to trash/src/trash-applet.h
diff --git a/trashapplet/src/trash-empty.c b/trash/src/trash-empty.c
similarity index 98%
rename from trashapplet/src/trash-empty.c
rename to trash/src/trash-empty.c
index 1ddde33..6e9ddea 100644
--- a/trashapplet/src/trash-empty.c
+++ b/trash/src/trash-empty.c
@@ -23,6 +23,8 @@
 #include "trash-empty.h"
 #include "config.h"
 
+#define GRESOURCE "/org/gnome/gnome-applets/trash/"
+
 /* only one concurrent trash empty operation can occur */
 static GtkDialog          *trash_empty_confirm_dialog;
 static GtkDialog          *trash_empty_dialog;
@@ -233,11 +235,11 @@ trash_empty_start (GtkWidget *parent)
   GCancellable *cancellable;
   GtkBuilder *builder;
   gint i;
+  const gchar *resource_name;
 
   builder = gtk_builder_new ();
-  gtk_builder_add_from_file (builder,
-                             GTK_BUILDERDIR "/trashapplet-empty-progress.ui",
-                             NULL);
+  resource_name = GRESOURCE "trash-empty.ui";
+  gtk_builder_add_from_resource (builder, resource_name, NULL);
 
   for (i = 0; i < G_N_ELEMENTS (widgets); i++)
     {
diff --git a/trashapplet/src/trash-empty.h b/trash/src/trash-empty.h
similarity index 100%
rename from trashapplet/src/trash-empty.h
rename to trash/src/trash-empty.h
diff --git a/trashapplet/trashapplet-empty-progress.ui b/trash/src/trash-empty.ui
similarity index 100%
rename from trashapplet/trashapplet-empty-progress.ui
rename to trash/src/trash-empty.ui
diff --git a/trashapplet/trashapplet-menu.xml b/trash/src/trash-menu.xml
similarity index 100%
rename from trashapplet/trashapplet-menu.xml
rename to trash/src/trash-menu.xml
diff --git a/trash/src/trash-resources.gresource.xml b/trash/src/trash-resources.gresource.xml
new file mode 100644
index 0000000..4c395f8
--- /dev/null
+++ b/trash/src/trash-resources.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+    <gresource prefix="/org/gnome/gnome-applets/trash">
+        <file compressed="true">trash-empty.ui</file>
+        <file compressed="true">trash-menu.xml</file>
+    </gresource>
+</gresources>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]