[Xfce4-commits] <xfce4-settings:master> Factorize more common code

Nick Schermer noreply at xfce.org
Sat Aug 28 23:04:17 CEST 2010


Updating branch refs/heads/master
         to 5617c8742e59188605ddc936375c57badc3b0a2a (commit)
       from cd7010ebf8c4e2288df8211079d1ee74bc86d9ab (commit)

commit 5617c8742e59188605ddc936375c57badc3b0a2a
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Sun Jun 13 12:52:05 2010 +0200

    Factorize more common code

 dialogs/display-settings/xfce-randr.c |   37 +++++++++++---------------------
 1 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index 5bb428d..e567fba 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -46,8 +46,21 @@ xfce_randr_populate (XfceRandr *randr,
     XRRCrtcInfo            *crtc_info;
     gint                    n;
 
+    g_return_val_if_fail (randr != NULL, FALSE);
     g_return_val_if_fail (randr->resources != NULL, FALSE);
 
+    /* set some layout */
+    randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
+
+    /* allocate space for the settings */
+    randr->mode = g_new0 (RRMode, randr->resources->noutput);
+    randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
+    randr->rotation = g_new0 (Rotation, randr->resources->noutput);
+    randr->rotations = g_new0 (Rotation, randr->resources->noutput);
+    randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
+    randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
+    randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
+
     /* walk the outputs */
     for (n = 0; n < randr->resources->noutput; n++)
     {
@@ -163,18 +176,6 @@ xfce_randr_new (GdkDisplay  *display,
     /* get the screen resource */
     randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
 
-    /* set some layout */
-    randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-
-    /* allocate space for the settings */
-    randr->mode = g_new0 (RRMode, randr->resources->noutput);
-    randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
-    randr->rotation = g_new0 (Rotation, randr->resources->noutput);
-    randr->rotations = g_new0 (Rotation, randr->resources->noutput);
-    randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
-    randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
-    randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
-
     if (!xfce_randr_populate (randr, xdisplay, root_window))
     {
         /* cleanup */
@@ -258,18 +259,6 @@ xfce_randr_reload (XfceRandr *randr)
 #endif
     randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
 
-    /* set some layout */
-    randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-
-    /* allocate space for the settings */
-    randr->mode = g_new0 (RRMode, randr->resources->noutput);
-    randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
-    randr->rotation = g_new0 (Rotation, randr->resources->noutput);
-    randr->rotations = g_new0 (Rotation, randr->resources->noutput);
-    randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
-    randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
-    randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
-
     /* repopulate */
     xfce_randr_populate (randr, xdisplay, root_window);
 }



More information about the Xfce4-commits mailing list