~ubuntu-branches/ubuntu/wily/gnome-applets/wily

« back to all changes in this revision

Viewing changes to mini-commander/src/mini-commander_applet.c

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2014-11-19 19:57:51 UTC
  • mfrom: (1.10.22)
  • Revision ID: package-import@ubuntu.com-20141119195751-gqirgm99dewik39n
Tags: 3.14.0-1~svn1
* New upstream release.
* Update (build-)dependencies for new version.
  - Require new GLib and libpanel-applet.
  - Switch from Python 2 to Python 3.
  - Drop GConf.
* Remove --enable-mixer-applet configure flag.
* Remove obsolete gnome-applets.gconf-defaults file.
* Update applet list in package description.
* Move Python modules to a private location.
* Use dh_python3.
* Use NEWS file as upstream changelog.
* Bump Standards-Version to 3.9.6, no changes needed.
* Update Homepage URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * GNU General Public License for more details.
18
18
 *
19
19
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program; if not, write to the Free Software
21
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22
21
 */
23
22
 
24
23
#include <config.h>
31
30
#include <gtk/gtk.h>
32
31
 
33
32
#include <panel-applet.h>
34
 
#include <gconf/gconf-client.h>
35
33
#include "mini-commander_applet.h"
36
34
#include "preferences.h"
37
35
#include "command_line.h"
38
36
#include "about.h"
39
37
#include "help.h"
 
38
#include "gsettings.h"
40
39
 
41
40
#include "browser-mini.xpm"
42
41
#include "history-mini.xpm"
49
48
static gboolean icons_initialized = FALSE;
50
49
static GtkIconSize button_icon_size = 0;
51
50
 
52
 
static const GtkActionEntry mini_commander_menu_actions [] = {
53
 
        { "Props", GTK_STOCK_PROPERTIES, N_("_Preferences"),
54
 
          NULL, NULL,
55
 
          G_CALLBACK (mc_show_preferences) },
56
 
        { "Help", GTK_STOCK_HELP, N_("_Help"),
57
 
          NULL, NULL,
58
 
          G_CALLBACK (show_help) },
59
 
        { "About", GTK_STOCK_ABOUT, N_("_About"),
60
 
          NULL, NULL,
61
 
          G_CALLBACK (about_box) }
 
51
static const GActionEntry mini_commander_menu_actions [] = {
 
52
        { "preferences", mc_show_preferences, NULL, NULL, NULL },
 
53
        { "help",        show_help,           NULL, NULL, NULL },
 
54
        { "about",       about_box,           NULL, NULL, NULL }
62
55
};
63
56
 
64
57
typedef struct {
203
196
    }
204
197
 
205
198
    if ( ((mc->orient == PANEL_APPLET_ORIENT_LEFT) || (mc->orient == PANEL_APPLET_ORIENT_RIGHT)) && (prefs.panel_size_x < 36) )
206
 
      mc->applet_box = gtk_vbox_new (FALSE, 0);
 
199
      mc->applet_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
207
200
    else
208
 
      mc->applet_box = gtk_hbox_new (FALSE, 0);
 
201
      mc->applet_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
209
202
 
210
203
    gtk_container_set_border_width (GTK_CONTAINER (mc->applet_box), 0);
211
204
 
219
212
    /* hbox for message label and buttons */
220
213
    if ((mc->orient == PANEL_APPLET_ORIENT_LEFT) || (mc->orient == PANEL_APPLET_ORIENT_RIGHT))
221
214
      if (prefs.panel_size_x < 36)
222
 
        hbox_buttons = gtk_vbox_new (TRUE, 0);
 
215
        hbox_buttons = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
223
216
      else
224
 
        hbox_buttons = gtk_hbox_new (TRUE, 0);
 
217
        hbox_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
225
218
    else
226
219
      if (prefs.normal_size_y > 36)
227
 
        hbox_buttons = gtk_vbox_new (TRUE, 0);
 
220
        hbox_buttons = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
228
221
      else
229
 
        hbox_buttons = gtk_hbox_new (TRUE, 0);
 
222
        hbox_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
223
 
 
224
    gtk_box_set_homogeneous (GTK_BOX (hbox_buttons), TRUE);
230
225
 
231
226
    /* add file-browser button */
232
227
    button = gtk_button_new ();
276
271
mc_destroyed (GtkWidget *widget,
277
272
              MCData    *mc)
278
273
{
279
 
    GConfClient *client;
280
 
    int          i;
 
274
    if (mc->global_settings) {
 
275
        g_object_unref (mc->global_settings);
 
276
        mc->global_settings = NULL;
 
277
    }
281
278
 
282
 
    client = gconf_client_get_default ();
283
 
    for (i = 0; i < MC_NUM_LISTENERS; i++) {
284
 
        gconf_client_notify_remove (client, mc->listeners [i]);
285
 
        mc->listeners [i] = 0;
 
279
    if (mc->settings) {
 
280
        g_object_unref (mc->settings);
 
281
        mc->settings = NULL;
286
282
    }
287
 
    g_object_unref (client);
288
283
 
289
284
    mc_macros_free (mc->preferences.macros);
290
285
 
 
286
    if (mc->preferences.cmd_line_color_fg)
 
287
       g_free (mc->preferences.cmd_line_color_fg);
 
288
 
 
289
    if (mc->preferences.cmd_line_color_bg)
 
290
       g_free (mc->preferences.cmd_line_color_bg);
 
291
 
291
292
    if (mc->prefs_dialog.dialog)
292
293
        gtk_widget_destroy (mc->prefs_dialog.dialog);
293
294
 
331
332
mini_commander_applet_fill (PanelApplet *applet)
332
333
{
333
334
    MCData *mc;
334
 
    GConfClient *client;
335
 
    GtkActionGroup *action_group;
 
335
    GSettings *settings;
 
336
    GSimpleActionGroup *action_group;
 
337
    GAction *action;
336
338
    gchar *ui_path;
337
339
 
338
 
    client = gconf_client_get_default ();
339
 
    if (gconf_client_get_bool (client, "/desktop/gnome/lockdown/inhibit_command_line", NULL)) {
 
340
    settings = g_settings_new (GNOME_DESKTOP_LOCKDOWN_SCHEMA);
 
341
    if (g_settings_get_boolean (settings, "disable-command-line")) {
340
342
            GtkWidget *error_dialog;
341
343
 
342
344
            error_dialog = gtk_message_dialog_new (NULL,
356
358
               command line is disabled */
357
359
            exit (1);
358
360
    }
 
361
    g_object_unref (settings);
359
362
 
360
363
    g_set_application_name (_("Command Line"));
361
364
 
364
367
    mc = g_new0 (MCData, 1);
365
368
    mc->applet = applet;
366
369
 
367
 
    panel_applet_add_preferences (applet, "/schemas/apps/mini-commander/prefs", NULL);
 
370
    mc->global_settings = g_settings_new (MINI_COMMANDER_GLOBAL_SCHEMA);
 
371
    mc->settings = panel_applet_settings_new (applet, MINI_COMMANDER_SCHEMA);
 
372
 
368
373
    panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
369
374
    mc_load_preferences (mc);
370
375
    command_line_init_stock_icons ();
374
379
    g_signal_connect (mc->applet, "size_allocate",
375
380
                      G_CALLBACK (mc_pixel_size_changed), mc);
376
381
 
377
 
    mc->preferences.normal_size_y = panel_applet_get_size (applet);
378
382
    mc->orient = panel_applet_get_orient (applet);
379
383
    mc_applet_draw(mc);
380
384
    gtk_widget_show (GTK_WIDGET (mc->applet));
385
389
    g_signal_connect (mc->applet, "key_press_event",
386
390
                      G_CALLBACK (key_press_cb), mc);
387
391
 
388
 
    action_group = gtk_action_group_new ("MiniCommander Applet Actions");
389
 
    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
390
 
    gtk_action_group_add_actions (action_group,
391
 
                                  mini_commander_menu_actions,
392
 
                                  G_N_ELEMENTS (mini_commander_menu_actions),
393
 
                                  mc);
 
392
    action_group = g_simple_action_group_new ();
 
393
    g_action_map_add_action_entries (G_ACTION_MAP (action_group),
 
394
                                     mini_commander_menu_actions,
 
395
                                     G_N_ELEMENTS (mini_commander_menu_actions),
 
396
                                     mc);
394
397
    ui_path = g_build_filename (MC_MENU_UI_DIR, "mini-commander-applet-menu.xml", NULL);
395
 
    panel_applet_setup_menu_from_file (mc->applet, ui_path, action_group);
396
 
 
397
 
    if (panel_applet_get_locked_down (mc->applet)) {
398
 
            GtkAction *action;
399
 
 
400
 
            action = gtk_action_group_get_action (action_group, "Props");
401
 
            gtk_action_set_visible (action, FALSE);
402
 
    }
 
398
    panel_applet_setup_menu_from_file (mc->applet, ui_path, action_group, GETTEXT_PACKAGE);
 
399
 
 
400
        gtk_widget_insert_action_group (GTK_WIDGET (applet), "mc",
 
401
                                        G_ACTION_GROUP (action_group));
 
402
 
 
403
    action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
 
404
        g_object_bind_property (applet, "locked-down",
 
405
                                action, "enabled",
 
406
                                G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
 
407
 
403
408
    g_object_unref (action_group);
404
409
 
405
410
    set_atk_name_description (GTK_WIDGET (applet),