~ubuntu-branches/ubuntu/trusty/anjuta/trusty

« back to all changes in this revision

Viewing changes to plugins/message-view/plugin.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-02-20 22:38:35 UTC
  • mfrom: (1.1.43)
  • Revision ID: package-import@ubuntu.com-20120220223835-ny223imz62qkk9ns
Tags: 2:3.3.90-0ubuntu1
* New upstream release.
* debian/rules: Watch for unstable releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-message-manager.xml"
31
31
#define PREFS_BUILDER PACKAGE_DATA_DIR"/glade/anjuta-message-manager-plugin.ui"
32
 
#define PREFERENCES_SCHEMA "org.gnome.anjuta.message-manager"
 
32
#define PREFERENCES_SCHEMA "org.gnome.anjuta.plugins.message-manager"
33
33
 
34
34
/* Pixmaps */
35
35
#define ANJUTA_PIXMAP_MESSAGES                "anjuta-messages-plugin-48.png"
112
112
        g_object_set (G_OBJECT (action_copy), "sensitive", sensitive, NULL);
113
113
 
114
114
        /* Toggle buttons */
115
 
        gtk_widget_set_sensitive (plugin->normal, sensitive);   
 
115
        gtk_widget_set_sensitive (plugin->normal, sensitive);
116
116
        gtk_widget_set_sensitive (plugin->info, sensitive);
117
117
        gtk_widget_set_sensitive (plugin->warn, sensitive);
118
118
        gtk_widget_set_sensitive (plugin->error, sensitive);
131
131
 
132
132
static void
133
133
register_stock_icons (AnjutaPlugin *plugin)
134
 
{       
 
134
{
135
135
        static gboolean registered = FALSE;
136
136
 
137
137
        if (registered)
154
154
        GtkWidget *popup;
155
155
        MessageViewPlugin *mv_plugin;
156
156
        static gboolean initialized = FALSE;
157
 
        
 
157
 
158
158
        DEBUG_PRINT ("%s", "MessageViewPlugin: Activating MessageView plugin ...");
159
159
        mv_plugin = ANJUTA_PLUGIN_MESSAGE_VIEW (plugin);
160
 
        
 
160
 
161
161
        if (!initialized)
162
162
        {
163
163
                register_stock_icons (plugin);
164
164
        }
165
165
        ui = anjuta_shell_get_ui (plugin->shell, NULL);
166
 
        mv_plugin->action_group = 
 
166
        mv_plugin->action_group =
167
167
                anjuta_ui_add_action_group_entries (ui, "ActionGroupGotoMessages",
168
168
                                                                                        _("Next/Previous Message"),
169
169
                                                                                        actions_goto,
171
171
                                                                                        GETTEXT_PACKAGE, TRUE, plugin);
172
172
        mv_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
173
173
        popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupMessageView");
174
 
        mv_plugin->msgman = 
 
174
        mv_plugin->msgman =
175
175
                anjuta_msgman_new(popup);
176
 
        g_signal_connect(mv_plugin->msgman, "view-changed", 
 
176
        g_signal_connect(mv_plugin->msgman, "view-changed",
177
177
                                         G_CALLBACK(on_view_changed), mv_plugin);
178
178
        GtkAction* action_next = anjuta_ui_get_action (ui, "ActionGroupGotoMessages",
179
179
                                                                   "ActionMessageNext");
184
184
        g_object_set (G_OBJECT (action_next), "sensitive", FALSE, NULL);
185
185
        g_object_set (G_OBJECT (action_prev), "sensitive", FALSE, NULL);
186
186
        g_object_set (G_OBJECT (action_copy), "sensitive", FALSE, NULL);
187
 
        
 
187
 
188
188
        initialized = TRUE;
189
189
        mv_plugin->widget_shown = FALSE;
190
190
        return TRUE;
195
195
{
196
196
        MessageViewPlugin *mplugin;
197
197
        AnjutaUI *ui = anjuta_shell_get_ui (plugin->shell, NULL);
198
 
        
 
198
 
199
199
        DEBUG_PRINT ("%s", "MessageViewPlugin: Dectivating message view plugin ...");
200
 
        
 
200
 
201
201
        mplugin = ANJUTA_PLUGIN_MESSAGE_VIEW (plugin);
202
202
 
203
203
        /* Widget is removed as soon as it is destroyed */
205
205
                gtk_widget_destroy (mplugin->msgman);
206
206
        anjuta_ui_unmerge (ui, mplugin->uiid);
207
207
        anjuta_ui_remove_action_group (ui, mplugin->action_group);
208
 
        
 
208
 
209
209
        mplugin->action_group = NULL;
210
210
        mplugin->msgman = NULL;
211
211
        mplugin->uiid = 0;
212
 
        
 
212
 
213
213
        return TRUE;
214
214
}
215
215
 
239
239
}
240
240
 
241
241
static void
242
 
message_view_plugin_class_init (GObjectClass *klass) 
 
242
message_view_plugin_class_init (GObjectClass *klass)
243
243
{
244
244
        AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
245
245
 
252
252
}
253
253
 
254
254
static gboolean
255
 
on_filter_button_tooltip (GtkWidget* widget, 
 
255
on_filter_button_tooltip (GtkWidget* widget,
256
256
                          gint        x,
257
257
                          gint        y,
258
258
                          gboolean    keyboard_mode,
265
265
                return FALSE;
266
266
        if (widget == plugin->normal)
267
267
        {
268
 
                temp = g_strdup_printf(ngettext ("%d Message", "%d Messages", 
 
268
                temp = g_strdup_printf(ngettext ("%d Message", "%d Messages",
269
269
                                                 message_view_get_count (view,
270
270
                                                                         MESSAGE_VIEW_SHOW_NORMAL)),
271
271
                                       message_view_get_count (view,
274
274
        }
275
275
        else if (widget == plugin->info)
276
276
        {
277
 
                temp = g_strdup_printf(ngettext ("%d Info", "%d Infos", 
 
277
                temp = g_strdup_printf(ngettext ("%d Info", "%d Infos",
278
278
                                                 message_view_get_count (view,
279
279
                                                                         MESSAGE_VIEW_SHOW_INFO)),
280
280
                                       message_view_get_count (view,
283
283
        }
284
284
        else if (widget == plugin->warn)
285
285
        {
286
 
                temp = g_strdup_printf(ngettext ("%d Warning", "%d Warnings", 
 
286
                temp = g_strdup_printf(ngettext ("%d Warning", "%d Warnings",
287
287
                                                 message_view_get_count (view,
288
288
                                                                         MESSAGE_VIEW_SHOW_WARNING)),
289
289
                                       message_view_get_count (view,
292
292
        }
293
293
        else if (widget == plugin->error)
294
294
        {
295
 
                temp = g_strdup_printf(ngettext ("%d Error", "%d Errors", 
 
295
                temp = g_strdup_printf(ngettext ("%d Error", "%d Errors",
296
296
                                                 message_view_get_count (view,
297
297
                                                                         MESSAGE_VIEW_SHOW_ERROR)),
298
298
                                       message_view_get_count (view,
330
330
{
331
331
        GtkWidget* button, *image;
332
332
        gint h,w;
333
 
        image = gtk_image_new_from_stock (stock_id, 
 
333
        image = gtk_image_new_from_stock (stock_id,
334
334
                                          GTK_ICON_SIZE_MENU);
335
335
        gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
336
336
        button = gtk_toggle_button_new ();
339
339
        gtk_container_add (GTK_CONTAINER (button), image);
340
340
 
341
341
        g_object_set (button, "has-tooltip", TRUE, NULL);
342
 
        g_signal_connect (button, "query-tooltip", 
 
342
        g_signal_connect (button, "query-tooltip",
343
343
                          G_CALLBACK (on_filter_button_tooltip), plugin);
344
 
        
 
344
 
345
345
        return button;
346
346
}
347
347
 
350
350
                       GtkWidget* hbox)
351
351
{
352
352
        GtkWidget* filter_buttons_box = gtk_hbox_new (FALSE, 0);
353
 
        
 
353
 
354
354
        plugin->normal = create_mini_button (plugin, "message-manager-plugin-icon");
355
355
        plugin->info = create_mini_button (plugin, GTK_STOCK_INFO);
356
356
        plugin->warn = create_mini_button (plugin, GTK_STOCK_DIALOG_WARNING);
357
357
        plugin->error = create_mini_button (plugin, GTK_STOCK_DIALOG_ERROR);
358
 
        
 
358
 
359
359
        gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (plugin->normal),
360
360
                                                FALSE, FALSE, 0);
361
361
        gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (plugin->info),
364
364
                                                FALSE, FALSE, 0);
365
365
        gtk_box_pack_start (GTK_BOX (filter_buttons_box), GTK_WIDGET (plugin->error),
366
366
                            FALSE, FALSE, 0);
367
 
        
 
367
 
368
368
        gtk_widget_show_all (filter_buttons_box);
369
369
        gtk_box_pack_start (GTK_BOX(hbox), filter_buttons_box, FALSE, FALSE, 0);
370
370
}
371
371
 
372
372
/*
373
 
 * IAnjutaMessagerManager interface implementation 
 
373
 * IAnjutaMessagerManager interface implementation
374
374
 */
375
375
static IAnjutaMessageView*
376
376
ianjuta_msgman_add_view (IAnjutaMessageManager *plugin,
390
390
                gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
391
391
                gtk_box_pack_start (GTK_BOX(hbox), anjuta_msgman_get_tabber (ANJUTA_MSGMAN(msgman)),
392
392
                                    TRUE, TRUE, 5);
393
 
        
 
393
 
394
394
                gtk_widget_show_all (hbox);
395
395
 
396
396
                create_toggle_buttons (ANJUTA_PLUGIN_MESSAGE_VIEW(plugin), hbox);
397
 
                
 
397
 
398
398
                anjuta_shell_add_widget_custom (shell, msgman,
399
399
                                                         "AnjutaMessageView", _("Messages"),
400
400
                                                         "message-manager-plugin-icon", hbox,
451
451
        GtkWidget *msgman = ANJUTA_PLUGIN_MESSAGE_VIEW (plugin)->msgman;
452
452
        anjuta_msgman_set_current_view (ANJUTA_MSGMAN (msgman),
453
453
                                               MESSAGE_VIEW (message_view));
454
 
        
 
454
 
455
455
        /* Ensure the message-view is visible! */
456
456
        g_object_get(G_OBJECT(plugin), "shell", &shell, NULL);
457
457
}
517
517
        anjuta_preferences_add_from_builder (prefs, bxml, plugin->settings,
518
518
                                                                        "Messages", _("Messages"),
519
519
                                                                         ANJUTA_PIXMAP_MESSAGES);
520
 
        
 
520
 
521
521
        g_signal_connect (plugin->settings, "changed::messages-tab-position",
522
 
                          G_CALLBACK (on_notify_message_pref), plugin->msgman);         
 
522
                          G_CALLBACK (on_notify_message_pref), plugin->msgman);
523
523
        g_object_unref (bxml);
524
524
}
525
525
 
533
533
ipreferences_iface_init(IAnjutaPreferencesIface* iface)
534
534
{
535
535
        iface->merge = ipreferences_merge;
536
 
        iface->unmerge = ipreferences_unmerge;  
 
536
        iface->unmerge = ipreferences_unmerge;
537
537
}
538
538
 
539
539
ANJUTA_PLUGIN_BEGIN (MessageViewPlugin, message_view_plugin);