From 7703c9e3e480629a7eeab8b4310f313b9b1784df Mon Sep 17 00:00:00 2001 From: Sorokin Alexei Date: Tue, 7 Jun 2016 18:53:50 +0300 Subject: rely less on GtkStock --- src/Makefile.am | 2 +- src/gpm-backlight.c | 2 +- src/gpm-engine.c | 4 ++-- src/gpm-icon-names.h | 41 +++++++++++++++++++++++++++++++++++++++++ src/gpm-main.c | 2 +- src/gpm-manager.c | 13 ++++++------- src/gpm-prefs-core.c | 4 ++-- src/gpm-statistics.c | 4 ++-- src/gpm-stock-icons.h | 41 ----------------------------------------- src/gpm-tray-icon.c | 19 ++++++++++--------- src/gpm-tray-icon.h | 2 +- 11 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 src/gpm-icon-names.h delete mode 100644 src/gpm-stock-icons.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index b7469ea..680384f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -172,7 +172,7 @@ mate_power_manager_SOURCES = \ gpm-session.c \ gpm-networkmanager.h \ gpm-networkmanager.c \ - gpm-stock-icons.h \ + gpm-icon-names.h \ gsd-media-keys-window.h \ gsd-media-keys-window.c \ msd-osd-window.h \ diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c index a4629ad..48a33c7 100644 --- a/src/gpm-backlight.c +++ b/src/gpm-backlight.c @@ -52,7 +52,7 @@ #include "gpm-dpms.h" #include "gpm-idle.h" #include "gpm-marshal.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "egg-console-kit.h" #if !GTK_CHECK_VERSION(3,0,0) diff --git a/src/gpm-engine.c b/src/gpm-engine.c index f1ae198..61cdba4 100644 --- a/src/gpm-engine.c +++ b/src/gpm-engine.c @@ -32,7 +32,7 @@ #include "gpm-upower.h" #include "gpm-marshal.h" #include "gpm-engine.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-phone.h" static void gpm_engine_finalize (GObject *object); @@ -443,7 +443,7 @@ gpm_engine_get_icon (GpmEngine *engine) /* we fallback to the ac_adapter icon */ egg_debug ("Using fallback"); - return g_strdup (GPM_STOCK_AC_ADAPTER); + return g_strdup (GPM_ICON_AC_ADAPTER); } /** diff --git a/src/gpm-icon-names.h b/src/gpm-icon-names.h new file mode 100644 index 0000000..004e70e --- /dev/null +++ b/src/gpm-icon-names.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2002 Jorn Baayen + * Copyright (C) 2003,2004 Colin Walters + * Copyright (C) 2005-2007 Richard Hughes + * + * Licensed under the GNU General Public License Version 2 + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GPM_ICON_NAMES_H +#define __GPM_ICON_NAMES_H + +G_BEGIN_DECLS + +#define GPM_ICON_APP_ICON "mate-power-manager" +#define GPM_ICON_AC_ADAPTER "gpm-ac-adapter" +#define GPM_ICON_BATTERY_CHARGED "gpm-primary-charged" +#define GPM_ICON_SUSPEND "gpm-suspend" +#define GPM_ICON_HIBERNATE "gpm-hibernate" +#define GPM_ICON_STATISTICS "mate-power-statistics" +#define GPM_ICON_BRIGHTNESS_LCD "gpm-brightness-lcd" +#define GPM_ICON_BRIGHTNESS_KBD "gpm-brightness-kbd" +#define GPM_ICON_INHIBIT "gpm-inhibit" + +G_END_DECLS + +#endif /* __GPM_ICON_NAMES_H */ diff --git a/src/gpm-main.c b/src/gpm-main.c index 30cf481..6186d6e 100644 --- a/src/gpm-main.c +++ b/src/gpm-main.c @@ -36,7 +36,7 @@ #include #include -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-common.h" #include "gpm-manager.h" #include "gpm-session.h" diff --git a/src/gpm-manager.c b/src/gpm-manager.c index 050d3ec..d07cae8 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -56,7 +56,7 @@ #include "gpm-backlight.h" #include "gpm-kbd-backlight.h" #include "gpm-session.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-tray-icon.h" #include "gpm-engine.h" #include "gpm-upower.h" @@ -579,13 +579,13 @@ gpm_manager_sleep_failure (GpmManager *manager, gboolean is_suspend, const gchar g_string_append (string, _("Computer failed to suspend.")); /* TRANSLATORS: title text */ title = _("Failed to suspend"); - icon = GPM_STOCK_SUSPEND; + icon = GPM_ICON_SUSPEND; } else { /* TRANSLATORS: message text */ g_string_append (string, _("Computer failed to hibernate.")); /* TRANSLATORS: title text */ title = _("Failed to hibernate"); - icon = GPM_STOCK_HIBERNATE; + icon = GPM_ICON_HIBERNATE; } /* TRANSLATORS: message text */ @@ -926,7 +926,7 @@ gpm_manager_button_pressed_cb (GpmButton *button, const gchar *type, GpmManager _("Power Information"), message, GPM_MANAGER_NOTIFY_TIMEOUT_LONG, - GTK_STOCK_DIALOG_INFO, + "dialog-information", NOTIFY_URGENCY_NORMAL); g_free (message); } @@ -1116,7 +1116,7 @@ gpm_manager_engine_low_capacity_cb (GpmEngine *engine, UpDevice *device, GpmMana message = g_strdup_printf (_("Battery has a very low capacity (%1.1f%%), " "which means that it may be old or broken."), capacity); gpm_manager_notify (manager, &manager->priv->notification_general, title, message, GPM_MANAGER_NOTIFY_TIMEOUT_SHORT, - GTK_STOCK_DIALOG_INFO, NOTIFY_URGENCY_LOW); + "dialog-information", NOTIFY_URGENCY_LOW); out: g_free (message); } @@ -1165,7 +1165,7 @@ gpm_manager_engine_fully_charged_cb (GpmEngine *engine, UpDevice *device, GpmMan title = ngettext ("Battery Charged", "Batteries Charged", plural); gpm_manager_notify (manager, &manager->priv->notification_fully_charged, title, NULL, GPM_MANAGER_NOTIFY_TIMEOUT_SHORT, - GTK_STOCK_DIALOG_INFO, NOTIFY_URGENCY_LOW); + "dialog-information", NOTIFY_URGENCY_LOW); } out: g_free (native_path); @@ -1790,7 +1790,6 @@ static void gpm_manager_init (GpmManager *manager) { gboolean check_type_cpu; - gint timeout; DBusGConnection *connection; GDBusConnection *g_connection; GError *error = NULL; diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index ef7edad..4bef861 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -39,7 +39,7 @@ #include "gpm-tray-icon.h" #include "gpm-common.h" #include "gpm-prefs-core.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-brightness.h" static void gpm_prefs_finalize (GObject *object); @@ -842,7 +842,7 @@ gpm_prefs_init (GpmPrefs *prefs) /* Hide window first so that the dialogue resizes itself without redrawing */ gtk_widget_hide (main_window); - gtk_window_set_default_icon_name (GPM_STOCK_APP_ICON); + gtk_window_set_default_icon_name (GPM_ICON_APP_ICON); /* Get the main window quit */ g_signal_connect (main_window, "delete_event", diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index f800cef..9fab6bc 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -36,7 +36,7 @@ #include "egg-unique.h" #include "gpm-common.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-upower.h" #include "gpm-graph-widget.h" @@ -1642,7 +1642,7 @@ main (int argc, char *argv[]) widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_stats")); gtk_window_set_default_size (GTK_WINDOW(widget), 800, 500); - gtk_window_set_default_icon_name (GPM_STOCK_APP_ICON); + gtk_window_set_default_icon_name (GPM_ICON_APP_ICON); /* Get the main window quit */ g_signal_connect_swapped (widget, "delete_event", G_CALLBACK (gtk_main_quit), NULL); diff --git a/src/gpm-stock-icons.h b/src/gpm-stock-icons.h deleted file mode 100644 index 395d612..0000000 --- a/src/gpm-stock-icons.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2002 Jorn Baayen - * Copyright (C) 2003,2004 Colin Walters - * Copyright (C) 2005-2007 Richard Hughes - * - * Licensed under the GNU General Public License Version 2 - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __GPM_STOCK_ICONS_H -#define __GPM_STOCK_ICONS_H - -G_BEGIN_DECLS - -#define GPM_STOCK_APP_ICON "mate-power-manager" -#define GPM_STOCK_AC_ADAPTER "gpm-ac-adapter" -#define GPM_STOCK_BATTERY_CHARGED "gpm-primary-charged" -#define GPM_STOCK_HIBERNATE "gpm-hibernate" -#define GPM_STOCK_SUSPEND "gpm-suspend" -#define GPM_STOCK_STATISTICS "mate-power-statistics" -#define GPM_STOCK_BRIGHTNESS_LCD "gpm-brightness-lcd" -#define GPM_STOCK_BRIGHTNESS_KBD "gpm-brightness-kbd" -#define GPM_STOCK_INHIBIT "gpm-inhibit" - -G_END_DECLS - -#endif /* __GPM_STOCK_ICONS_H */ diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index 28e30c5..6d4b2f9 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -46,7 +46,7 @@ #include "gpm-upower.h" #include "gpm-engine.h" #include "gpm-common.h" -#include "gpm-stock-icons.h" +#include "gpm-icon-names.h" #include "gpm-tray-icon.h" static void gpm_tray_icon_finalize (GObject *object); @@ -111,20 +111,21 @@ gpm_tray_icon_get_status_icon (GpmTrayIcon *icon) } /** - * gpm_tray_icon_set_image_from_stock: - * @filename: The icon name, e.g. GPM_STOCK_APP_ICON, or NULL to remove. + * gpm_tray_icon_set_icon: + * @icon_name: The icon name, e.g. GPM_ICON_APP_ICON, or NULL to remove. * - * Loads a pixmap from disk, and sets as the tooltip icon + * Loads a pixmap from disk, and sets as the tooltip icon. **/ gboolean -gpm_tray_icon_set_icon (GpmTrayIcon *icon, const gchar *filename) +gpm_tray_icon_set_icon (GpmTrayIcon *icon, const gchar *icon_name) { g_return_val_if_fail (icon != NULL, FALSE); g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), FALSE); - if (filename != NULL) { - egg_debug ("Setting icon to %s", filename); - gtk_status_icon_set_from_icon_name (icon->priv->status_icon, filename); + if (icon_name != NULL) { + egg_debug ("Setting icon to %s", icon_name); + gtk_status_icon_set_from_icon_name (icon->priv->status_icon, + icon_name); /* make sure that we are visible */ gpm_tray_icon_show (icon, TRUE); @@ -328,7 +329,7 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon, guint32 timestamp) /* preferences */ item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences")); - image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name ("preferences-system", GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (gpm_tray_icon_show_preferences_cb), icon); diff --git a/src/gpm-tray-icon.h b/src/gpm-tray-icon.h index 5ff828f..03bc943 100644 --- a/src/gpm-tray-icon.h +++ b/src/gpm-tray-icon.h @@ -55,7 +55,7 @@ GpmTrayIcon *gpm_tray_icon_new (void); gboolean gpm_tray_icon_set_tooltip (GpmTrayIcon *icon, const gchar *tooltip); gboolean gpm_tray_icon_set_icon (GpmTrayIcon *icon, - const gchar *filename); + const gchar *icon_name); GtkStatusIcon *gpm_tray_icon_get_status_icon (GpmTrayIcon *icon); G_END_DECLS -- cgit v1.2.1