aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/indicator-menu-item.c14
-rw-r--r--src/indicator-printer-state-notifier.c18
-rw-r--r--src/indicator-printers-menu.c11
-rw-r--r--src/indicator-printers-service.c2
-rw-r--r--src/indicator-printers.c11
-rw-r--r--test/mock-cups-notifier.c4
6 files changed, 13 insertions, 47 deletions
diff --git a/src/indicator-menu-item.c b/src/indicator-menu-item.c
index 94e10ba..ed89a0f 100644
--- a/src/indicator-menu-item.c
+++ b/src/indicator-menu-item.c
@@ -20,10 +20,6 @@
#include <math.h>
-
-G_DEFINE_TYPE (IndicatorMenuItem, indicator_menu_item, GTK_TYPE_MENU_ITEM)
-
-
struct _IndicatorMenuItemPrivate
{
GtkImage *image;
@@ -32,6 +28,7 @@ struct _IndicatorMenuItemPrivate
gboolean right_is_lozenge;
};
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorMenuItem, indicator_menu_item, GTK_TYPE_MENU_ITEM)
enum {
PROP_0,
@@ -51,8 +48,7 @@ gtk_widget_get_font_size (GtkWidget *widget)
{
const PangoFontDescription *font;
- font = gtk_style_context_get_font (gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_style_context_get(gtk_widget_get_style_context(widget), gtk_widget_get_state_flags(widget), "font", &font, NULL);
return pango_font_description_get_size (font) / PANGO_SCALE;
}
@@ -216,8 +212,6 @@ indicator_menu_item_class_init (IndicatorMenuItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorMenuItemPrivate));
-
object_class->get_property = indicator_menu_item_get_property;
object_class->set_property = indicator_menu_item_set_property;
object_class->dispose = indicator_menu_item_dispose;
@@ -263,9 +257,7 @@ indicator_menu_item_init (IndicatorMenuItem *self)
gint spacing;
GtkWidget *hbox;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_MENU_ITEM,
- IndicatorMenuItemPrivate);
+ priv = indicator_menu_item_get_instance_private(self);
self->priv = priv;
gtk_widget_style_get (GTK_WIDGET (self),
diff --git a/src/indicator-printer-state-notifier.c b/src/indicator-printer-state-notifier.c
index c83ba82..7a587a0 100644
--- a/src/indicator-printer-state-notifier.c
+++ b/src/indicator-printer-state-notifier.c
@@ -30,10 +30,6 @@
#define RESPONSE_SHOW_SYSTEM_SETTINGS 1
-
-G_DEFINE_TYPE (IndicatorPrinterStateNotifier, indicator_printer_state_notifier, G_TYPE_OBJECT)
-
-
struct _IndicatorPrinterStateNotifierPrivate
{
CupsNotifier *cups_notifier;
@@ -45,6 +41,7 @@ struct _IndicatorPrinterStateNotifierPrivate
GHashTable *printer_alerts;
};
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorPrinterStateNotifier, indicator_printer_state_notifier, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -107,7 +104,7 @@ show_alert_box (const gchar *printer,
primary_text = g_strdup_printf (reason, printer);
secondary_text = g_strdup_printf (ngettext(
- "You have %d job queued to print on this printer.",
+ "You have %d job queued to print on this printer.",
"You have %d jobs queued to print on this printer.", njobs),
njobs);
@@ -127,10 +124,7 @@ show_alert_box (const gchar *printer,
g_free (primary_text);
g_free (secondary_text);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("_Settingsā€¦"), RESPONSE_SHOW_SYSTEM_SETTINGS,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ gtk_dialog_add_buttons(GTK_DIALOG (dialog), _("_Settingsā€¦"), RESPONSE_SHOW_SYSTEM_SETTINGS, _("_OK"), GTK_RESPONSE_OK, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
gtk_widget_show_all (dialog);
@@ -260,8 +254,6 @@ indicator_printer_state_notifier_class_init (IndicatorPrinterStateNotifierClass
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorPrinterStateNotifierPrivate));
-
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->dispose = dispose;
@@ -282,9 +274,7 @@ indicator_printer_state_notifier_init (IndicatorPrinterStateNotifier *self)
{
IndicatorPrinterStateNotifierPrivate *priv;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_PRINTER_STATE_NOTIFIER,
- IndicatorPrinterStateNotifierPrivate);
+ priv = indicator_printer_state_notifier_get_instance_private(self);
self->priv = priv;
priv->notified_printer_states = g_hash_table_new_full (g_str_hash,
diff --git a/src/indicator-printers-menu.c b/src/indicator-printers-menu.c
index 69394df..54ea281 100644
--- a/src/indicator-printers-menu.c
+++ b/src/indicator-printers-menu.c
@@ -24,10 +24,6 @@
#include "spawn-printer-settings.h"
-
-G_DEFINE_TYPE (IndicatorPrintersMenu, indicator_printers_menu, G_TYPE_OBJECT)
-
-
struct _IndicatorPrintersMenuPrivate
{
DbusmenuMenuitem *root;
@@ -35,6 +31,7 @@ struct _IndicatorPrintersMenuPrivate
CupsNotifier *cups_notifier;
};
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorPrintersMenu, indicator_printers_menu, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -107,8 +104,6 @@ indicator_printers_menu_class_init (IndicatorPrintersMenuClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorPrintersMenuPrivate));
-
object_class->dispose = dispose;
object_class->get_property = get_property;
object_class->set_property = set_property;
@@ -276,9 +271,7 @@ on_printer_state_changed (CupsNotifier *object,
static void
indicator_printers_menu_init (IndicatorPrintersMenu *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_TYPE_PRINTERS_MENU,
- IndicatorPrintersMenuPrivate);
+ self->priv = indicator_printers_menu_get_instance_private(self);
self->priv->root = dbusmenu_menuitem_new ();
dbusmenu_menuitem_property_set_bool (self->priv->root, "visible", FALSE);
diff --git a/src/indicator-printers-service.c b/src/indicator-printers-service.c
index e275657..8d31360 100644
--- a/src/indicator-printers-service.c
+++ b/src/indicator-printers-service.c
@@ -22,7 +22,7 @@
#include <cups/cups.h>
#include "dbus-names.h"
#include "config.h"
-
+#include <glib/gi18n-lib.h>
#include "cups-notifier.h"
#include "indicator-printers-menu.h"
#include "indicator-printer-state-notifier.h"
diff --git a/src/indicator-printers.c b/src/indicator-printers.c
index c52fdaa..ba263c9 100644
--- a/src/indicator-printers.c
+++ b/src/indicator-printers.c
@@ -36,16 +36,13 @@
INDICATOR_SET_VERSION
INDICATOR_SET_TYPE(INDICATOR_PRINTERS_TYPE)
-
-G_DEFINE_TYPE (IndicatorPrinters, indicator_printers, INDICATOR_OBJECT_TYPE)
-
-
struct _IndicatorPrintersPrivate
{
IndicatorObjectEntry entry;
guint name_watch;
};
+G_DEFINE_TYPE_WITH_PRIVATE(IndicatorPrinters, indicator_printers, INDICATOR_OBJECT_TYPE)
static void
dispose (GObject *object)
@@ -75,8 +72,6 @@ indicator_printers_class_init (IndicatorPrintersClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
IndicatorObjectClass *io_class = INDICATOR_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (IndicatorPrintersPrivate));
-
object_class->dispose = dispose;
io_class->get_entries = get_entries;
@@ -270,9 +265,7 @@ indicator_printers_init (IndicatorPrinters *self)
DbusmenuClient *client;
GtkImage *image;
- priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- INDICATOR_PRINTERS_TYPE,
- IndicatorPrintersPrivate);
+ priv = indicator_printers_get_instance_private(self);
self->priv = priv;
priv->name_watch = g_bus_watch_name(G_BUS_TYPE_SESSION,
diff --git a/test/mock-cups-notifier.c b/test/mock-cups-notifier.c
index 10d5fe5..7903f91 100644
--- a/test/mock-cups-notifier.c
+++ b/test/mock-cups-notifier.c
@@ -6,12 +6,10 @@
int main (int argc, char **argv)
{
GMainLoop *loop;
- CupsNotifier *notifier;
+ CupsNotifier *notifier = NULL;
GDBusConnection *con;
GError *error = NULL;
- g_type_init ();
-
loop = g_main_loop_new (NULL, FALSE);
con = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);