~mterry/indicator-printers/snap-root

« back to all changes in this revision

Viewing changes to src/indicator-printers-service.c

  • Committer: Tarmac
  • Author(s): Ted Gould
  • Date: 2014-02-25 16:27:11 UTC
  • mfrom: (67.1.8 startup-cleanup)
  • Revision ID: tarmac-20140225162711-m5jljn623vm4o40k
Synchronize process management across indicators.

Approved by Charles Kerr, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    ippDelete (resp);
133
133
}
134
134
 
135
 
 
136
 
static void
137
 
service_shutdown (IndicatorService *service, gpointer user_data)
138
 
{
139
 
    int subscription_id = GPOINTER_TO_INT (user_data);
140
 
 
141
 
    g_debug("Shutting down indicator-printers-service");
142
 
 
143
 
    cancel_subscription (subscription_id);
144
 
    gtk_main_quit ();
145
 
}
146
 
 
147
 
 
148
135
int main (int argc, char *argv[])
149
136
{
150
137
    /* Init i18n */
153
140
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
154
141
    textdomain (GETTEXT_PACKAGE);
155
142
 
156
 
    IndicatorService *service;
157
143
    DbusmenuServer *menuserver;
158
144
    CupsNotifier *cups_notifier;
159
145
    IndicatorPrintersMenu *menu;
168
154
                           renew_subscription_timeout,
169
155
                           &subscription_id);
170
156
 
171
 
    service = indicator_service_new_version (INDICATOR_PRINTERS_DBUS_NAME,
172
 
                                             INDICATOR_PRINTERS_DBUS_VERSION);
173
 
    g_signal_connect (service,
174
 
                      "shutdown",
175
 
                      G_CALLBACK (service_shutdown),
176
 
                      GINT_TO_POINTER (subscription_id));
177
 
 
178
157
    cups_notifier = cups_notifier_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
179
158
                                                          0,
180
159
                                                          NULL,
184
163
    if (error) {
185
164
        g_warning ("Error creating cups notify handler: %s", error->message);
186
165
        g_error_free (error);
187
 
        g_object_unref (service);
188
166
        return 1;
189
167
    }
190
168
 
206
184
    g_object_unref (menuserver);
207
185
    g_object_unref (state_notifier);
208
186
    g_object_unref (cups_notifier);
209
 
    g_object_unref (service);
210
187
    return 0;
211
188
}
212
189