~ubuntu-branches/debian/sid/xfce4-clipman-plugin/sid

« back to all changes in this revision

Viewing changes to panel-plugin/menu.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez
  • Date: 2012-04-09 21:26:50 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20120409212650-u618echcdsndz3ak
Tags: 2:1.2.3-1
* New upstream release.
* debian/rules:
  - build with --parallel.
  - configure with --disable-static and stop removing .a files.
* debian/control:
  - update standards version to 3.9.3.
  - update debhelper build-dep to 9. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (c) 2008-2011 Mike Massonnet <mmassonnet@xfce.org>
 
2
 *  Copyright (c) 2008-2012 Mike Massonnet <mmassonnet@xfce.org>
3
3
 *
4
4
 *  This program is free software; you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU General Public License as published by
20
20
#include <config.h>
21
21
#endif
22
22
 
 
23
#include <exo/exo.h>
23
24
#include <gtk/gtk.h>
24
25
#include <libxfce4ui/libxfce4ui.h>
25
26
#include <libxfce4util/libxfce4util.h>
49
50
  GSList               *list;
50
51
  gboolean              reverse_order;
51
52
  guint                 paste_on_activate;
 
53
  gboolean              never_confirm_history_clear;
52
54
};
53
55
 
54
56
enum
56
58
  REVERSE_ORDER = 1,
57
59
  INHIBIT_MENU_ITEM,
58
60
  PASTE_ON_ACTIVATE,
 
61
  NEVER_CONFIRM_HISTORY_CLEAR,
59
62
};
60
63
 
61
64
static void             clipman_menu_finalize           (GObject *object);
184
187
static void
185
188
cb_clear_history (ClipmanMenu *menu)
186
189
{
 
190
  gint res;
 
191
  GtkWidget *dialog;
187
192
  GtkClipboard *clipboard;
188
193
 
189
 
  if (!xfce_dialog_confirm (NULL, GTK_STOCK_YES, NULL, _("Are you sure you want to clear the history?"), NULL))
190
 
    return;
 
194
  if (!menu->priv->never_confirm_history_clear)
 
195
    {
 
196
      dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
 
197
                                       GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
 
198
                                       _("Are you sure you want to clear the history?"));
 
199
 
 
200
 
 
201
      {
 
202
#if GTK_CHECK_VERSION(2, 22, 0)
 
203
        GtkWidget *content_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
 
204
#else
 
205
        GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
206
#endif
 
207
        GtkWidget *checkbox = gtk_check_button_new_with_label (_("Don't ask again"));
 
208
        exo_binding_new (G_OBJECT (checkbox), "active", G_OBJECT (menu), "never-confirm-history-clear");
 
209
        gtk_widget_show (checkbox);
 
210
        gtk_container_add (GTK_CONTAINER (content_area), checkbox);
 
211
 
 
212
        res = gtk_dialog_run (GTK_DIALOG (dialog));
 
213
        gtk_widget_destroy (dialog);
 
214
 
 
215
        if (res != GTK_RESPONSE_YES)
 
216
          {
 
217
            g_object_set (menu, "never-confirm-history-clear", FALSE, NULL);
 
218
            return;
 
219
          }
 
220
      }
 
221
 
 
222
    }
191
223
 
192
224
  clipman_history_clear (menu->priv->history);
193
225
 
338
370
                                                      "Paste the content of a menu item when it is activated",
339
371
                                                      0, 2, 0,
340
372
                                                      G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
 
373
 
 
374
  g_object_class_install_property (object_class, NEVER_CONFIRM_HISTORY_CLEAR,
 
375
                                   g_param_spec_boolean ("never-confirm-history-clear",
 
376
                                                         "NeverConfirmHistoryClear",
 
377
                                                         "Set to FALSE to clear the history list with confirmation",
 
378
                                                         FALSE,
 
379
                                                         G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
341
380
}
342
381
 
343
382
static void
399
438
      priv->paste_on_activate = g_value_get_uint (value);
400
439
      break;
401
440
 
 
441
    case NEVER_CONFIRM_HISTORY_CLEAR:
 
442
      priv->never_confirm_history_clear = g_value_get_boolean (value);
 
443
      break;
 
444
 
402
445
    default:
403
446
      break;
404
447
    }
426
469
      g_value_set_uint (value, priv->paste_on_activate);
427
470
      break;
428
471
 
 
472
    case NEVER_CONFIRM_HISTORY_CLEAR:
 
473
      g_value_set_boolean (value, priv->never_confirm_history_clear);
 
474
      break;
 
475
 
429
476
    default:
430
477
      break;
431
478
    }