From e34f12e2f496225c94111549f80e5f48ac3c9c1d Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Aug 2020 22:26:50 +0200 Subject: Use ayatanamenuitemfactory.(c|h) from ayatana-ido. Reduce code duplications. --- debian/libayatana-indicator3-7.symbols | 6 +-- libayatana-indicator/Makefile.am | 4 +- libayatana-indicator/ayatanamenuitemfactory.c | 69 --------------------------- libayatana-indicator/ayatanamenuitemfactory.h | 61 ----------------------- libayatana-indicator/indicator-ng.c | 2 +- 5 files changed, 6 insertions(+), 136 deletions(-) delete mode 100644 libayatana-indicator/ayatanamenuitemfactory.c delete mode 100644 libayatana-indicator/ayatanamenuitemfactory.h diff --git a/debian/libayatana-indicator3-7.symbols b/debian/libayatana-indicator3-7.symbols index 6ff69cc..5ea656f 100644 --- a/debian/libayatana-indicator3-7.symbols +++ b/debian/libayatana-indicator3-7.symbols @@ -2,9 +2,9 @@ libayatana-indicator3.so.7 libayatana-indicator3-7 #MINVER# *Build-Depends-Package: libayatana-indicator3-dev ICON_SIZE@Base 0.6.0 INDICATOR_NAMES_DATA@Base 0.6.0 - ayatana_menu_item_factory_create_menu_item@Base 0.7.0 - ayatana_menu_item_factory_get_all@Base 0.7.0 - ayatana_menu_item_factory_get_type@Base 0.7.0 +#MISSING: 0.7.2-0# ayatana_menu_item_factory_create_menu_item@Base 0.7.0 +#MISSING: 0.7.2-0# ayatana_menu_item_factory_get_all@Base 0.7.0 +#MISSING: 0.7.2-0# ayatana_menu_item_factory_get_type@Base 0.7.0 indicator_desktop_shortcuts_get_nicks@Base 0.6.0 indicator_desktop_shortcuts_get_type@Base 0.6.0 indicator_desktop_shortcuts_new@Base 0.6.0 diff --git a/libayatana-indicator/Makefile.am b/libayatana-indicator/Makefile.am index f1e466e..ab6247d 100644 --- a/libayatana-indicator/Makefile.am +++ b/libayatana-indicator/Makefile.am @@ -39,7 +39,6 @@ indicator_headers = \ if USE_GTK3 indicator_headers += \ - ayatanamenuitemfactory.h \ indicator-ng.h endif @@ -62,12 +61,12 @@ libayatana_indicator_la_SOURCES = \ if USE_GTK3 libayatana_indicator_la_SOURCES += \ - ayatanamenuitemfactory.c \ indicator-ng.c endif libayatana_indicator_la_CFLAGS = \ $(LIBINDICATOR_CFLAGS) \ + $(LIBINDICATOR_IDO_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(GTK_DISABLE_DEPRECATED) \ -DG_LOG_DOMAIN=\"libayatana-indicator\" \ @@ -75,6 +74,7 @@ libayatana_indicator_la_CFLAGS = \ libayatana_indicator_la_LIBADD = \ $(LIBINDICATOR_LIBS) \ + $(LIBINDICATOR_IDO_LIBS) \ $(LIBM) libayatana_indicator_la_LDFLAGS = \ diff --git a/libayatana-indicator/ayatanamenuitemfactory.c b/libayatana-indicator/ayatanamenuitemfactory.c deleted file mode 100644 index 0e333ab..0000000 --- a/libayatana-indicator/ayatanamenuitemfactory.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -* Copyright 2013 Canonical Ltd. -* -* 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 . -* -* Authors: -* Lars Uebernickel -*/ - -#include "ayatanamenuitemfactory.h" - -G_DEFINE_INTERFACE_WITH_CODE (AyatanaMenuItemFactory, ayatana_menu_item_factory, G_TYPE_OBJECT, - GIOExtensionPoint *ep = g_io_extension_point_register (AYATANA_MENU_ITEM_FACTORY_EXTENSION_POINT_NAME); - g_io_extension_point_set_required_type (ep, g_define_type_id);) - -/* - * ayatana_menu_item_factory_get_all: - * - * Returns a static list of all registered factories. - */ -GList * -ayatana_menu_item_factory_get_all (void) -{ - static GList *factories = NULL; - - if (factories == NULL) - { - GIOExtensionPoint *ep; - GList *it; - - g_type_ensure (AYATANA_TYPE_MENU_ITEM_FACTORY); - ep = g_io_extension_point_lookup (AYATANA_MENU_ITEM_FACTORY_EXTENSION_POINT_NAME); - for (it = g_io_extension_point_get_extensions (ep); it != NULL; it = it->next) - { - GIOExtension *ext = it->data; - AyatanaMenuItemFactory *factory; - - factory = g_object_new (g_io_extension_get_type (ext), NULL); - factories = g_list_prepend (factories, factory); - } - factories = g_list_reverse (factories); - } - - return factories; -} - -static void -ayatana_menu_item_factory_default_init (AyatanaMenuItemFactoryInterface *iface) -{ -} - -GtkMenuItem * -ayatana_menu_item_factory_create_menu_item (AyatanaMenuItemFactory *factory, - const gchar *type, - GMenuItem *menuitem, - GActionGroup *actions) -{ - return AYATANA_MENU_ITEM_FACTORY_GET_IFACE (factory)->create_menu_item (factory, type, menuitem, actions); -} diff --git a/libayatana-indicator/ayatanamenuitemfactory.h b/libayatana-indicator/ayatanamenuitemfactory.h deleted file mode 100644 index 4a241be..0000000 --- a/libayatana-indicator/ayatanamenuitemfactory.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* Copyright 2013 Canonical Ltd. -* -* 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 . -* -* Authors: -* Lars Uebernickel -*/ - -#ifndef __AYATANA_MENU_ITEM_FACTORY_H__ -#define __AYATANA_MENU_ITEM_FACTORY_H__ - -#include - -G_BEGIN_DECLS - -#define AYATANA_TYPE_MENU_ITEM_FACTORY (ayatana_menu_item_factory_get_type ()) -#define AYATANA_MENU_ITEM_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), AYATANA_TYPE_MENU_ITEM_FACTORY, AyatanaMenuItemFactory)) -#define AYATANA_IS_MENU_ITEM_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), AYATANA_TYPE_MENU_ITEM_FACTORY)) -#define AYATANA_MENU_ITEM_FACTORY_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), AYATANA_TYPE_MENU_ITEM_FACTORY, AyatanaMenuItemFactoryInterface)) - -#define AYATANA_MENU_ITEM_FACTORY_EXTENSION_POINT_NAME "ayatana-menu-item-factory" - -typedef struct _AyatanaMenuItemFactoryInterface AyatanaMenuItemFactoryInterface; -typedef struct _AyatanaMenuItemFactory AyatanaMenuItemFactory; - -struct _AyatanaMenuItemFactoryInterface -{ - GTypeInterface iface; - - GtkMenuItem * (*create_menu_item) (AyatanaMenuItemFactory *factory, - const gchar *type, - GMenuItem *menuitem, - GActionGroup *actions); -}; - -GDK_AVAILABLE_IN_3_10 -GList * ayatana_menu_item_factory_get_all (void); - -GDK_AVAILABLE_IN_3_10 -GType ayatana_menu_item_factory_get_type (void); - -GDK_AVAILABLE_IN_3_10 -GtkMenuItem * ayatana_menu_item_factory_create_menu_item (AyatanaMenuItemFactory *factory, - const gchar *type, - GMenuItem *menuitem, - GActionGroup *actions); - -G_END_DECLS - -#endif diff --git a/libayatana-indicator/indicator-ng.c b/libayatana-indicator/indicator-ng.c index c0e85e5..a2c2102 100644 --- a/libayatana-indicator/indicator-ng.c +++ b/libayatana-indicator/indicator-ng.c @@ -19,7 +19,7 @@ #include "indicator-ng.h" #include "indicator-image-helper.h" -#include "ayatanamenuitemfactory.h" +#include #include #define MENU_SECTIONS 20 -- cgit v1.2.3