~ubuntu-branches/ubuntu/utopic/thunar/utopic-proposed

« back to all changes in this revision

Viewing changes to thunar/thunar-application.c

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2014-04-05 08:22:40 UTC
  • Revision ID: package-import@ubuntu.com-20140405082240-b3iiyypyyo3uliy3
Tags: 1.6.3-1ubuntu5
* Add git-save-keyboard-shortcuts.patch. LP: #1186846
  - Keyboard shortcuts save when changed rather than when thunar is closed
* Add menu-icon-tweaks.patch. LP: #1271861
  - Don't use generic folder icons for open with default application
  - Add icons for open in new tab, new window
* Add git-force-toolbr-icons.patch
  - Fix for "Home" and "Open Parent" icons going missing from toolbar

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include <thunar/thunar-util.h>
60
60
#include <thunar/thunar-view.h>
61
61
 
 
62
#define ACCEL_MAP_PATH "Thunar/accels.scm"
 
63
 
62
64
 
63
65
 
64
66
/* Prototype for the Thunar job launchers */
85
87
                                                                 guint                   prop_id,
86
88
                                                                 const GValue           *value,
87
89
                                                                 GParamSpec             *pspec);
 
90
static void           thunar_application_accel_map_changed      (ThunarApplication      *application);
 
91
static gboolean       thunar_application_accel_map_save         (gpointer                user_data);
88
92
static void           thunar_application_collect_and_launch     (ThunarApplication      *application,
89
93
                                                                 gpointer                parent,
90
94
                                                                 const gchar            *icon_name,
142
146
 
143
147
  gboolean               daemon;
144
148
 
 
149
  guint                  accel_map_save_id;
 
150
  GtkAccelMap           *accel_map;
 
151
 
145
152
  guint                  show_dialogs_timer_id;
146
153
 
147
154
#ifdef HAVE_GUDEV
220
227
  application->progress_dialog = NULL;
221
228
 
222
229
  /* check if we have a saved accel map */
223
 
  path = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, "Thunar/accels.scm");
 
230
  path = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, ACCEL_MAP_PATH);
224
231
  if (G_LIKELY (path != NULL))
225
232
    {
226
233
      /* load the accel map */
228
235
      g_free (path);
229
236
    }
230
237
 
 
238
  /* watch for changes */
 
239
  application->accel_map = gtk_accel_map_get ();
 
240
  g_signal_connect_swapped (G_OBJECT (application->accel_map), "changed",
 
241
      G_CALLBACK (thunar_application_accel_map_changed), application);
 
242
 
231
243
#ifdef HAVE_GUDEV
232
244
  /* establish connection with udev */
233
245
  application->udev_client = g_udev_client_new (subsystems);
245
257
thunar_application_finalize (GObject *object)
246
258
{
247
259
  ThunarApplication *application = THUNAR_APPLICATION (object);
248
 
  gchar             *path;
249
260
  GList             *lp;
250
261
 
251
262
  /* unqueue all files waiting to be processed */
252
263
  thunar_g_file_list_free (application->files_to_launch);
253
264
 
254
265
  /* save the current accel map */
255
 
  path = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "Thunar/accels.scm", TRUE);
256
 
  if (G_LIKELY (path != NULL))
 
266
  if (G_UNLIKELY (application->accel_map_save_id != 0))
257
267
    {
258
 
      /* save the accel map */
259
 
      gtk_accel_map_save (path);
260
 
      g_free (path);
 
268
      g_source_remove (application->accel_map_save_id);
 
269
      thunar_application_accel_map_save (application);
261
270
    }
262
271
 
 
272
  if (application->accel_map != NULL)
 
273
    g_object_unref (G_OBJECT (application->accel_map));
 
274
 
263
275
#ifdef HAVE_GUDEV
264
276
  /* cancel any pending volman watch source */
265
277
  if (G_UNLIKELY (application->volman_watch_id != 0))
348
360
 
349
361
 
350
362
 
 
363
static gboolean
 
364
thunar_application_accel_map_save (gpointer user_data)
 
365
{
 
366
  ThunarApplication *application = THUNAR_APPLICATION (user_data);
 
367
  gchar             *path;
 
368
 
 
369
  _thunar_return_val_if_fail (THUNAR_IS_APPLICATION (application), FALSE);
 
370
 
 
371
  application->accel_map_save_id = 0;
 
372
 
 
373
  /* save the current accel map */
 
374
  path = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, ACCEL_MAP_PATH, TRUE);
 
375
  if (G_LIKELY (path != NULL))
 
376
    {
 
377
      /* save the accel map */
 
378
      gtk_accel_map_save (path);
 
379
      g_free (path);
 
380
    }
 
381
 
 
382
  return FALSE;
 
383
}
 
384
 
 
385
 
 
386
 
 
387
static void
 
388
thunar_application_accel_map_changed (ThunarApplication *application)
 
389
{
 
390
  _thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
 
391
 
 
392
  /* stop pending save */
 
393
  if (application->accel_map_save_id != 0)
 
394
    {
 
395
      g_source_remove (application->accel_map_save_id);
 
396
      application->accel_map_save_id = 0;
 
397
    }
 
398
 
 
399
  /* schedule new save */
 
400
  application->accel_map_save_id =
 
401
      g_timeout_add_seconds (10, thunar_application_accel_map_save, application);
 
402
}
 
403
 
 
404
 
 
405
 
351
406
static void
352
407
thunar_application_collect_and_launch (ThunarApplication *application,
353
408
                                       gpointer           parent,