~shnatsel/ubuntu/precise/gnome-control-center/fix-939882

« back to all changes in this revision

Viewing changes to panels/display/cc-display-panel.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha, Ken VanDine
  • Date: 2012-02-15 23:16:31 UTC
  • mfrom: (1.1.56)
  • Revision ID: package-import@ubuntu.com-20120215231631-vk7me0mhofpsq0hp
Tags: 1:3.3.5-0ubuntu1
* Upload the new serie, that will bring in quite some fixes, we revert
  some problematic or risky changes as well
* The new version includes those fixes:
  - "Change Password in User Accounts panel focuses "New password" field, 
     skipping "Current password"" (lp: #821759)
  - The dialog to add online accounts should have a title 
    (lp: #822380)
  - "Remove Profile" button clickable in Color panel when 
     no profile selected (lp: #869603)
  - Move Removable Media into System Info (lp: #835880)
  - Sound preferences: mouse scrolling balance only works for right.
    (lp: #918017)
  - gnome-control-center SIGSEGV in actualize_printers_list() 
    (lp: #903009)
  - selecting preffered applications is not an info (lp: #890143)
  - Add a keyboard shortcut by default for take screenshot of a selection"
    (lp: #625518)
* debian/patches/revert_git_datetime_port.patch:
  - revert use of datetimed, we don't use systemd and ubuntu-system-service 
    doesn't support it yet
* debian/patches/revert_git_drop_library.patch:
  - consolidate "01_allow_external_panels.patch", don't drop the library
    we use it from other components on ubuntu, the patch will be improved
    later to not use a copy of files like it does in that version
* debian/patches/revert_git_stop_using_gconf.patch,
  debian/patches/revert_ua_gsettings.patch,
  debian/patches/revert_git_keyboard_gsettings.patch:
  - revert keyboard porting to gsettings, compiz still use gconf and we
    didn't update gnome-shell to the new serie (yet)

[ Jeremy Bicha ]
* New upstream release (Thanks Rico Tzchichholz!)
* debian/control.in:
  - Bump minimum dependency versions and add libwacom dependency
* debian/rules: Build without -Wl,-z,defs
* debian/watch: Watch for unstable releases
* Refreshed patches:
  - 01_allow_external_panels.patch
  - 04_add_theme_selection.patch
  - 50_ubuntu_systemwide_prefs.patch
  - 58_ubuntu_icon_views_redesign.patch
  - 59_install_gcm_components_on_demand.patch
  - 91_configure_cheese.patch
* Dropped upstream patches:
  - 00git_handle_media_dialog_close.patch
  - 03_show_wacom_under_unity.patch
  - 90_git_sound_tab_order.patch
  - 91_git_build_use_fontconfig.patch
  - 92_git_minimal_output_height.patch
  - 93_change_window_role_on_panel_change.patch
  - 94_git_adding_shortcuts.patch
  - 95_git_ctrlw_shortcut.patch
  - git_extra_keywords.patch

[ Ken VanDine ]
* debian/patches/96_sound_nua_panel.patch
  - refreshed with latest changes from ronoc

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <gdk/gdkx.h>
36
36
#include <X11/Xlib.h>
37
37
#include <glib/gi18n.h>
38
 
#include <dbus/dbus-glib.h>
39
 
#include <dbus/dbus-glib-bindings.h>
40
38
#include <gdesktop-enums.h>
41
39
 
42
40
G_DEFINE_DYNAMIC_TYPE (CcDisplayPanel, cc_display_panel, CC_TYPE_PANEL)
95
93
  gboolean        dragging_top_bar;
96
94
 
97
95
  /* These are used while we are waiting for the ApplyConfiguration method to be executed over D-bus */
98
 
  DBusGConnection *connection;
99
 
  DBusGProxy *proxy;
100
 
  DBusGProxyCall *proxy_call;
 
96
  GDBusProxy *proxy;
101
97
};
102
98
 
103
99
typedef struct
114
110
static void select_current_output_from_dialog_position (CcDisplayPanel *self);
115
111
static void monitor_switch_active_cb (GObject *object, GParamSpec *pspec, gpointer data);
116
112
static void get_geometry (GnomeRROutputInfo *output, int *w, int *h);
117
 
static void apply_configuration_returned_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, void *data);
 
113
static void apply_configuration_returned_cb (GObject *proxy, GAsyncResult *res, gpointer data);
118
114
static gboolean get_clone_size (GnomeRRScreen *screen, int *width, int *height);
119
115
static gboolean output_info_supports_mode (CcDisplayPanel *self, GnomeRROutputInfo *info, int width, int height);
120
116
static char *make_resolution_string (int width, int height);
474
470
    const char *        name;
475
471
  } RotationInfo;
476
472
  static const RotationInfo rotations[] = {
477
 
    { GNOME_RR_ROTATION_0, N_("Normal") },
478
 
    { GNOME_RR_ROTATION_90, N_("Counterclockwise") },
479
 
    { GNOME_RR_ROTATION_270, N_("Clockwise") },
480
 
    { GNOME_RR_ROTATION_180, N_("180 Degrees") },
 
473
    { GNOME_RR_ROTATION_0, NC_("display panel, rotation", "Normal") },
 
474
    { GNOME_RR_ROTATION_90, NC_("display panel, rotation", "Counterclockwise") },
 
475
    { GNOME_RR_ROTATION_270, NC_("display panel, rotation", "Clockwise") },
 
476
    { GNOME_RR_ROTATION_180, NC_("display panel, rotation", "180 Degrees") },
481
477
  };
482
478
  const char *selection;
483
479
  GnomeRRRotation current;
513
509
  gnome_rr_output_info_set_rotation (self->priv->current_output, current);
514
510
 
515
511
  if (!(selection && combo_select (self->priv->rotation_combo, selection)))
516
 
    combo_select (self->priv->rotation_combo, _(rotations[0].name));
 
512
    gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->rotation_combo), 0);
517
513
}
518
514
 
519
515
static int
2250
2246
begin_version2_apply_configuration (CcDisplayPanel *self, GdkWindow *parent_window, guint32 timestamp)
2251
2247
{
2252
2248
  XID parent_window_xid;
 
2249
  GError *error = NULL;
2253
2250
 
2254
2251
  parent_window_xid = GDK_WINDOW_XID (parent_window);
2255
2252
 
2256
 
  self->priv->proxy = dbus_g_proxy_new_for_name (self->priv->connection,
2257
 
                                          "org.gnome.SettingsDaemon",
2258
 
                                          "/org/gnome/SettingsDaemon/XRANDR",
2259
 
                                          "org.gnome.SettingsDaemon.XRANDR_2");
2260
 
  g_assert (self->priv->proxy != NULL); /* that call does not fail unless we pass bogus names */
 
2253
  self->priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
 
2254
                                                     G_DBUS_PROXY_FLAGS_NONE,
 
2255
                                                     NULL,
 
2256
                                                     "org.gnome.SettingsDaemon",
 
2257
                                                     "/org/gnome/SettingsDaemon/XRANDR",
 
2258
                                                     "org.gnome.SettingsDaemon.XRANDR_2",
 
2259
                                                     NULL,
 
2260
                                                     &error);
 
2261
  if (self->priv->proxy == NULL) {
 
2262
    error_message (self, _("Failed to apply configuration: %s"), error->message);
 
2263
    g_error_free (error);
 
2264
    return;
 
2265
  }
2261
2266
 
2262
 
  self->priv->proxy_call = dbus_g_proxy_begin_call (self->priv->proxy, "ApplyConfiguration",
2263
 
                                             apply_configuration_returned_cb, self,
2264
 
                                             NULL,
2265
 
                                             G_TYPE_INT64, (gint64) parent_window_xid,
2266
 
                                             G_TYPE_INT64, (gint64) timestamp,
2267
 
                                             G_TYPE_INVALID,
2268
 
                                             G_TYPE_INVALID);
2269
 
  /* FIXME: we don't check for self->priv->proxy_call == NULL, which could happen if
2270
 
   * the connection was disconnected.  This is left as an exercise for the
2271
 
   * reader.
2272
 
   */
 
2267
  g_dbus_proxy_call (self->priv->proxy,
 
2268
                     "ApplyConfiguration",
 
2269
                     g_variant_new ("(xx)", (gint64) parent_window_xid, (gint64) timestamp),
 
2270
                     G_DBUS_CALL_FLAGS_NONE,
 
2271
                     -1,
 
2272
                     NULL,
 
2273
                     apply_configuration_returned_cb,
 
2274
                     self);
2273
2275
}
2274
2276
 
2275
2277
static void
2298
2300
  g_object_unref (rr_screen);
2299
2301
}
2300
2302
 
2301
 
/* Callback for dbus_g_proxy_begin_call() */
2302
2303
static void
2303
 
apply_configuration_returned_cb (DBusGProxy       *proxy,
2304
 
                                 DBusGProxyCall   *call_id,
2305
 
                                 void             *data)
 
2304
apply_configuration_returned_cb (GObject          *proxy,
 
2305
                                 GAsyncResult     *res,
 
2306
                                 gpointer          data)
2306
2307
{
2307
2308
  CcDisplayPanel *self = data;
2308
 
  gboolean success;
2309
 
  GError *error;
2310
 
 
2311
 
  g_assert (call_id == self->priv->proxy_call);
2312
 
 
2313
 
  error = NULL;
2314
 
  success = dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID);
2315
 
 
2316
 
  if (!success) {
2317
 
    /* We don't pop up an error message; gnome-settings-daemon already does that
2318
 
     * in case the selected RANDR configuration could not be applied.
2319
 
     */
2320
 
    g_error_free (error);
2321
 
  }
 
2309
  GVariant *result;
 
2310
  GError *error = NULL;
 
2311
 
 
2312
  result = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, &error);
 
2313
  if (error)
 
2314
    error_message (self, _("Failed to apply configuration: %s"), error->message);
 
2315
  g_clear_error (&error);  
 
2316
  if (result)
 
2317
    g_variant_unref (result);
2322
2318
 
2323
2319
  g_object_unref (self->priv->proxy);
2324
2320
  self->priv->proxy = NULL;
2325
2321
 
2326
 
  dbus_g_connection_unref (self->priv->connection);
2327
 
  self->priv->connection = NULL;
2328
 
  self->priv->proxy_call = NULL;
2329
 
 
2330
2322
  gtk_widget_set_sensitive (self->priv->panel, TRUE);
2331
2323
}
2332
2324
 
2358
2350
static void
2359
2351
apply (CcDisplayPanel *self)
2360
2352
{
2361
 
  GError *error = NULL;
2362
2353
  GdkWindow *window;
2363
2354
 
2364
2355
  self->priv->apply_button_clicked_timestamp = gtk_get_current_event_time ();
2366
2357
  if (!sanitize_and_save_configuration (self))
2367
2358
    return;
2368
2359
 
2369
 
  g_assert (self->priv->connection == NULL);
2370
2360
  g_assert (self->priv->proxy == NULL);
2371
 
  g_assert (self->priv->proxy_call == NULL);
2372
 
 
2373
 
  self->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
2374
 
  if (self->priv->connection == NULL) {
2375
 
    error_message (self, _("Could not get session bus while applying display configuration"), error->message);
2376
 
    g_error_free (error);
2377
 
    return;
2378
 
  }
2379
2361
 
2380
2362
  gtk_widget_set_sensitive (self->priv->panel, FALSE);
2381
2363