Author: nick
Date: 2008-06-14 14:22:50 +0000 (Sat, 14 Jun 2008)
New Revision: 27059

Removed:
   libxfce4ui/trunk/libxfce4ui/xfce-pango-extensions.c
   libxfce4ui/trunk/libxfce4ui/xfce-pango-extensions.h
Modified:
   libxfce4ui/trunk/docs/libxfce4ui-docs.sgml
   libxfce4ui/trunk/docs/libxfce4ui-sections.txt
   libxfce4ui/trunk/libxfce4ui/Makefile.am
   libxfce4ui/trunk/libxfce4ui/libxfce4ui.h
   libxfce4ui/trunk/libxfce4ui/libxfce4ui.symbols
   libxfce4ui/trunk/libxfce4ui/xfce-execute.c
   libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.c
   libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.h
   libxfce4ui/trunk/libxfce4ui/xfce-gtk-extensions.c
Log:
* From xfce_pango_attr_list_new() from the API, not usefull enough.
  Using the code internally for creating styled labels.
* Optionally return the monitor number in xfce_gdk_screen_get_active().


Modified: libxfce4ui/trunk/docs/libxfce4ui-docs.sgml
===================================================================
--- libxfce4ui/trunk/docs/libxfce4ui-docs.sgml  2008-06-14 13:56:51 UTC (rev 
27058)
+++ libxfce4ui/trunk/docs/libxfce4ui-docs.sgml  2008-06-14 14:22:50 UTC (rev 
27059)
@@ -5,7 +5,6 @@
 <!ENTITY xfce-execute SYSTEM "xml/xfce-execute.xml">
 <!ENTITY xfce-gdk-extensions SYSTEM "xml/xfce-gdk-extensions.xml">
 <!ENTITY xfce-gtk-extensions SYSTEM "xml/xfce-gtk-extensions.xml">
-<!ENTITY xfce-pango-extensions SYSTEM "xml/xfce-pango-extensions.xml">
 <!ENTITY xfce-dialogs SYSTEM "xml/xfce-dialogs.xml">
 <!ENTITY xfce-titled-dialog SYSTEM "xml/xfce-titled-dialog.xml">
 
@@ -64,7 +63,6 @@
     <title>Xfce UI Extensions</title>
     &xfce-gdk-extensions;
     &xfce-gtk-extensions;
-    &xfce-pango-extensions;
   </part>
 
   <part id="libxfce4ui-widgets">

Modified: libxfce4ui/trunk/docs/libxfce4ui-sections.txt
===================================================================
--- libxfce4ui/trunk/docs/libxfce4ui-sections.txt       2008-06-14 13:56:51 UTC 
(rev 27058)
+++ libxfce4ui/trunk/docs/libxfce4ui-sections.txt       2008-06-14 14:22:50 UTC 
(rev 27059)
@@ -41,11 +41,6 @@
 </SECTION>
 
 <SECTION>
-<FILE>xfce-pango-extensions</FILE>
-xfce_pango_attr_list_new
-</SECTION>
-
-<SECTION>
 <FILE>xfce-dialogs</FILE>
 xfce_message_dialog_new
 xfce_message_dialog_run

Modified: libxfce4ui/trunk/libxfce4ui/Makefile.am
===================================================================
--- libxfce4ui/trunk/libxfce4ui/Makefile.am     2008-06-14 13:56:51 UTC (rev 
27058)
+++ libxfce4ui/trunk/libxfce4ui/Makefile.am     2008-06-14 14:22:50 UTC (rev 
27059)
@@ -9,6 +9,13 @@
        -DLIBEXECDIR=\"$(libexecdir)\"                                  \
        -DLIBXFCE4UI_VERSION_API=\"$(LIBXFCE4UI_VERSION_API)\"          \
        -DPACKAGE_LOCALE_DIR=\"$(localedir)\"                           \
+       -DG_DISABLE_DEPRECATED                                          \
+       -DG_DISABLE_SINGLE_INCLUDES                                     \
+       -DGTK_DISABLE_DEPRECATED                                        \
+       -DGTK_DISABLE_SINGLE_INCLUDES                                   \
+       -DGDK_DISABLE_DEPRECATED                                        \
+       -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES                            \
+       -DPANGO_DISABLE_SINGLE_INCLUDES                                 \
        $(PLATFORM_CPPFLAGS)
 
 lib_LTLIBRARIES = libxfce4ui-1.la
@@ -18,7 +25,6 @@
        xfce-dialogs.h                                                  \
        xfce-gdk-extensions.h                                           \
        xfce-gtk-extensions.h                                           \
-       xfce-pango-extensions.h                                         \
        xfce-titled-dialog.h
 
 libxfce4ui_built_sources =                                             \
@@ -44,7 +50,6 @@
        xfce-gtk-extensions.c                                           \
        xfce-heading.c                                                  \
        xfce-heading.h                                                  \
-       xfce-pango-extensions.c                                         \
        xfce-titled-dialog.c
 
 libxfce4ui_1_la_CFLAGS =                                               \

Modified: libxfce4ui/trunk/libxfce4ui/libxfce4ui.h
===================================================================
--- libxfce4ui/trunk/libxfce4ui/libxfce4ui.h    2008-06-14 13:56:51 UTC (rev 
27058)
+++ libxfce4ui/trunk/libxfce4ui/libxfce4ui.h    2008-06-14 14:22:50 UTC (rev 
27059)
@@ -28,7 +28,6 @@
 #include <libxfce4ui/xfce-dialogs.h>
 #include <libxfce4ui/xfce-gdk-extensions.h>
 #include <libxfce4ui/xfce-gtk-extensions.h>
-#include <libxfce4ui/xfce-pango-extensions.h>
 #include <libxfce4ui/xfce-titled-dialog.h>
 
 #undef LIBXFCE4UI_INSIDE_LIBXFCE4UI_H

Modified: libxfce4ui/trunk/libxfce4ui/libxfce4ui.symbols
===================================================================
--- libxfce4ui/trunk/libxfce4ui/libxfce4ui.symbols      2008-06-14 13:56:51 UTC 
(rev 27058)
+++ libxfce4ui/trunk/libxfce4ui/libxfce4ui.symbols      2008-06-14 14:22:50 UTC 
(rev 27059)
@@ -86,13 +86,6 @@
 #endif
 #endif
 
-/* xfce-pango-extensions functions */
-#if IN_HEADER(__XFCE_PANGO_EXTENSIONS_H__)
-#if IN_SOURCE(__XFCE_PANGO_EXTENSIONS_C__)
-xfce_pango_attr_list_new G_GNUC_MALLOC
-#endif
-#endif
-
 /* xfce-titled-dialog functions */
 #if IN_HEADER(__XFCE_TITLED_DIALOG_H__)
 #if IN_SOURCE(__XFCE_TITLED_DIALOG_C__)

Modified: libxfce4ui/trunk/libxfce4ui/xfce-execute.c
===================================================================
--- libxfce4ui/trunk/libxfce4ui/xfce-execute.c  2008-06-14 13:56:51 UTC (rev 
27058)
+++ libxfce4ui/trunk/libxfce4ui/xfce-execute.c  2008-06-14 14:22:50 UTC (rev 
27059)
@@ -236,7 +236,7 @@
 
   /* lookup the screen with the pointer */
   if (screen == NULL)
-    screen = xfce_gdk_screen_get_active ();
+    screen = xfce_gdk_screen_get_active (NULL);
 
   /* use environ when envp is null */
   if (G_LIKELY (envp == NULL))

Modified: libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.c
===================================================================
--- libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.c   2008-06-14 13:56:51 UTC 
(rev 27058)
+++ libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.c   2008-06-14 14:22:50 UTC 
(rev 27059)
@@ -90,6 +90,7 @@
 
 /**
  * xfce_gdk_screen_get_active:
+ * @monitor_return : Address to store the monitor number to or %NULL.
  *
  * Returns the currently active #GdkScreen, that is, the screen which
  * currently contains the pointer. If no active screen was found, the
@@ -98,7 +99,7 @@
  * Return value: the currently active #GdkScreen.
  **/
 GdkScreen *
-xfce_gdk_screen_get_active (void)
+xfce_gdk_screen_get_active (gint *monitor_return)
 {
 #ifdef GDK_WINDOWING_X11
   GdkScreen *screen;
@@ -124,6 +125,10 @@
                              GDK_DRAWABLE_XID (gdk_screen_get_root_window 
(screen)),
                              &root, &child, &rootx, &rooty, &winx, &winy, 
&xmask))
             {
+              /* return the monitor number */
+              if (monitor_return)
+                *monitor_return = gdk_screen_get_monitor_at_point (screen, 
rootx, rooty);
+              
               /* yap, this screen contains the pointer, hence it's the active 
screen */
               goto out;
             }
@@ -132,6 +137,10 @@
 
   /* fallback to the default screen */
   screen = gdk_screen_get_default ();
+  
+  /* no monitor was found */
+  if (monitor_return)
+    *monitor_return = 0;
 
 out:
   /* release the displays */

Modified: libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.h
===================================================================
--- libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.h   2008-06-14 13:56:51 UTC 
(rev 27058)
+++ libxfce4ui/trunk/libxfce4ui/xfce-gdk-extensions.h   2008-06-14 14:22:50 UTC 
(rev 27059)
@@ -34,7 +34,7 @@
                                                     gint          width,
                                                     gint          height) 
G_GNUC_MALLOC;
 
-GdkScreen *xfce_gdk_screen_get_active              (void);
+GdkScreen *xfce_gdk_screen_get_active              (gint         
*monitor_return);
 
 G_END_DECLS
 

Modified: libxfce4ui/trunk/libxfce4ui/xfce-gtk-extensions.c
===================================================================
--- libxfce4ui/trunk/libxfce4ui/xfce-gtk-extensions.c   2008-06-14 13:56:51 UTC 
(rev 27058)
+++ libxfce4ui/trunk/libxfce4ui/xfce-gtk-extensions.c   2008-06-14 14:22:50 UTC 
(rev 27059)
@@ -23,10 +23,10 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <pango/pango.h>
 
 #include <libxfce4ui/xfce-gtk-extensions.h>
 #include <libxfce4ui/xfce-gdk-extensions.h>
-#include <libxfce4ui/xfce-pango-extensions.h>
 #include <libxfce4ui/libxfce4ui-private.h>
 #include <libxfce4ui/libxfce4ui-alias.h>
 
@@ -35,6 +35,18 @@
 
 
 
+static void
+xfce_pango_attr_list_insert (PangoAttrList  *attr_list,
+                             PangoAttribute *attribute)
+{
+  /* set the attribute index and insert it into the list */
+  attribute->start_index = 0;
+  attribute->end_index = -1;
+  pango_attr_list_insert (attr_list, attribute);
+}
+
+
+
 /**
  * xfce_gtk_button_new_mixed:
  * @stock_id : the name of the stock item.
@@ -113,9 +125,22 @@
   /* create the label */
   widget = gtk_label_new (label);
 
-  /* create the attributes list */
-  attr_list = xfce_pango_attr_list_new (scale_factor, style, weight, 
underline);
+  /* create attribules list */
+  attr_list = pango_attr_list_new ();
+  
+  /* insert the user attributes if they differ from normal */
+  if (scale_factor != PANGO_SCALE_MEDIUM)
+    xfce_pango_attr_list_insert (attr_list, pango_attr_scale_new 
(scale_factor));
 
+  if (style != PANGO_STYLE_NORMAL)
+    xfce_pango_attr_list_insert (attr_list, pango_attr_style_new (style));
+
+  if (weight != PANGO_WEIGHT_NORMAL)
+    xfce_pango_attr_list_insert (attr_list, pango_attr_weight_new (weight));
+
+  if (underline != PANGO_UNDERLINE_NONE)
+    xfce_pango_attr_list_insert (attr_list, pango_attr_underline_new 
(underline));
+
   /* set attributes list */
   gtk_label_set_attributes (GTK_LABEL (widget), attr_list);
 
@@ -262,7 +287,7 @@
 
   /* use the active screen */
   if (screen == NULL)
-    screen = xfce_gdk_screen_get_active ();
+    screen = xfce_gdk_screen_get_active (NULL);
 
   /* return the window */
   if (G_LIKELY (window_return != NULL))
@@ -280,6 +305,9 @@
  * Determines the screen that contains the pointer and centers the
  * @window on it. If it failes to determine the current pointer position,
  * @window is centered on the default screen.
+ * 
+ * This function only works properly if you call it before realizing the
+ * window and you haven't set a fixed window position using gtk_window_move().
  *
  * See also: xfce_gdk_screen_get_active().
  */
@@ -291,11 +319,11 @@
   g_return_if_fail (GTK_IS_WINDOW (window));
 
   /* get the screen with the pointer */
-  screen = xfce_gdk_screen_get_active ();
+  screen = xfce_gdk_screen_get_active (NULL);
 
   /* set the window screen */
   gtk_window_set_screen (window, screen);
-
+  
   /* gtk+ handles the centering of the window properly after resize */
   gtk_window_set_position (window, GTK_WIN_POS_CENTER);
 }

Deleted: libxfce4ui/trunk/libxfce4ui/xfce-pango-extensions.c

Deleted: libxfce4ui/trunk/libxfce4ui/xfce-pango-extensions.h

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to