[dia] [gtk-deprecated] Get rid of some GdkPixmap and all GtkType



commit 0d723944b4c3f512253d2fb343a4459221c836a6
Author: Hans Breuer <hans breuer org>
Date:   Sun Nov 7 19:45:18 2010 +0100

    [gtk-deprecated] Get rid of some GdkPixmap and all GtkType

 app/diapagelayout.c                  |   45 +++++++++++++---------------------
 app/interface.c                      |   21 ++++-----------
 app/splash.c                         |    9 +------
 lib/diaarrowchooser.c                |    4 +-
 makefile.msc                         |    4 +++
 objects/AADL/edit_port_declaration.c |    1 -
 6 files changed, 30 insertions(+), 54 deletions(-)
---
diff --git a/app/diapagelayout.c b/app/diapagelayout.c
index 45461d5..4eca2f5 100644
--- a/app/diapagelayout.c
+++ b/app/diapagelayout.c
@@ -25,7 +25,6 @@
 #include <config.h>
 #endif
 
-#undef GTK_DISABLE_DEPRECATED /* GtkOptionMenu, ... */
 #include "diapagelayout.h"
 #include "widgets.h"
 
@@ -88,23 +87,24 @@ static void dia_page_layout_class_init(DiaPageLayoutClass *class);
 static void dia_page_layout_init(DiaPageLayout *self);
 static void dia_page_layout_destroy(GtkObject *object);
 
-GtkType
+GType
 dia_page_layout_get_type(void)
 {
-  static GtkType pl_type = 0;
+  static GType pl_type = 0;
 
   if (!pl_type) {
-    static const GtkTypeInfo pl_info = {
-      "DiaPageLayout",
-      sizeof(DiaPageLayout),
+    static const GTypeInfo pl_info = {
       sizeof(DiaPageLayoutClass),
-      (GtkClassInitFunc) dia_page_layout_class_init,
-      (GtkObjectInitFunc) dia_page_layout_init,
-      NULL,
-      NULL,
-      (GtkClassInitFunc) NULL,
+      NULL,		/* base_init */
+      NULL,		/* base_finalize */
+      (GClassInitFunc)dia_page_layout_class_init,
+      NULL,		/* class_finalize */
+      NULL,		/* class_data */
+      sizeof(DiaPageLayout),
+      0,		/* n_preallocs */
+      (GInstanceInitFunc) dia_page_layout_init,
     };
-    pl_type = gtk_type_unique(gtk_table_get_type(), &pl_info);
+    pl_type = g_type_register_static (gtk_table_get_type (), "DiaPageLayout", &pl_info, 0);
   }
   return pl_type;
 }
@@ -115,7 +115,7 @@ dia_page_layout_class_init(DiaPageLayoutClass *class)
   GtkObjectClass *object_class;
   
   object_class = (GtkObjectClass*) class;
-  parent_class = gtk_type_class(gtk_table_get_type());
+  parent_class = g_type_class_peek_parent (class);
 
   pl_signals[CHANGED] =
     g_signal_new("changed",
@@ -144,8 +144,6 @@ static void
 dia_page_layout_init(DiaPageLayout *self)
 {
   GtkWidget *frame, *box, *table, *wid;
-  GdkPixmap *pix;
-  GdkBitmap *mask;
   GList *paper_names;
   gint i;
 
@@ -194,12 +192,8 @@ dia_page_layout_init(DiaPageLayout *self)
   gtk_widget_show(box);
 
   self->orient_portrait = gtk_radio_button_new(NULL);
-  pix = gdk_pixmap_colormap_create_from_xpm_d(NULL,
-		gtk_widget_get_colormap(GTK_WIDGET(self)), &mask, NULL,
-		portrait_xpm);
-  wid = gtk_pixmap_new(pix, mask);
-  g_object_unref(pix);
-  g_object_unref(mask);
+  
+  wid = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data (portrait_xpm));
   gtk_container_add(GTK_CONTAINER(self->orient_portrait), wid);
   gtk_widget_show(wid);
 
@@ -208,12 +202,7 @@ dia_page_layout_init(DiaPageLayout *self)
 
   self->orient_landscape = gtk_radio_button_new(
 	gtk_radio_button_get_group(GTK_RADIO_BUTTON(self->orient_portrait)));
-  pix = gdk_pixmap_colormap_create_from_xpm_d(NULL,
-		gtk_widget_get_colormap(GTK_WIDGET(self)), &mask, NULL,
-		landscape_xpm);
-  wid = gtk_pixmap_new(pix, mask);
-  g_object_unref(pix);
-  g_object_unref(mask);
+  wid = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data (landscape_xpm));
   gtk_container_add(GTK_CONTAINER(self->orient_landscape), wid);
   gtk_widget_show(wid);
 
@@ -384,7 +373,7 @@ dia_page_layout_init(DiaPageLayout *self)
 GtkWidget *
 dia_page_layout_new(void)
 {
-  DiaPageLayout *self = gtk_type_new(dia_page_layout_get_type());
+  DiaPageLayout *self = g_object_new(dia_page_layout_get_type(), NULL);
 
   dia_page_layout_set_paper(self, "");
   return GTK_WIDGET(self);
diff --git a/app/interface.c b/app/interface.c
index a4f7dc9..0e81663 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -22,7 +22,7 @@
 #undef GTK_DISABLE_DEPRECATED /* gnome */
 #include <gnome.h>
 #else
-#undef GTK_DISABLE_DEPRECATED /* GtkPixmap, gtk_type_new, gtk_object_set_data_full */
+#undef GTK_DISABLE_DEPRECATED /* GtkPixmap */
 #include <gtk/gtk.h>
 #endif
 #include "gtkwrapbox.h"
@@ -1102,17 +1102,8 @@ create_widget_from_xpm_or_gdkp(gchar **icon_data, GtkWidget *button)
     p = gdk_pixbuf_new_from_inline(-1, (guint8*)icon_data, TRUE, NULL);
     pixmapwidget = gtk_image_new_from_pixbuf(p);
   } else {
-    GdkBitmap *mask = NULL;
-    GtkStyle *style;
-    char **pixmap_data;
-    GdkPixmap *pixmap = NULL;
-
-    pixmap_data = icon_data;
-    style = gtk_widget_get_style(button);
-    pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
-						   gtk_widget_get_colormap(button), &mask,
-						   &style->bg[GTK_STATE_NORMAL], pixmap_data);
-    pixmapwidget = gtk_pixmap_new(pixmap, mask);
+    char **pixmap_data = icon_data;
+    pixmapwidget = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data (pixmap_data));
   }
   return pixmapwidget;
 }
@@ -1292,7 +1283,7 @@ fill_sheet_wbox(Sheet *sheet)
       g_object_unref(pixmap);
       if (mask) g_object_unref(mask);
     } else {
-      pixmapwidget = gtk_type_new(gtk_pixmap_get_type());
+      pixmapwidget = g_object_new (gtk_pixmap_get_type(), NULL);
     }
 
     button = gtk_radio_button_new (tool_group);
@@ -1311,8 +1302,8 @@ fill_sheet_wbox(Sheet *sheet)
     data->type = CREATE_OBJECT_TOOL;
     data->extra_data = sheet_obj->object_type;
     data->user_data = sheet_obj->user_data;
-    gtk_object_set_data_full(GTK_OBJECT(button), "Dia::ToolButtonData",
-			     data, (GdkDestroyNotify)g_free);
+    g_object_set_data_full(G_OBJECT(button), "Dia::ToolButtonData",
+			   data, (GDestroyNotify)g_free);
     if (first_button == NULL) first_button = button;
     
     g_signal_connect (GTK_OBJECT (button), "clicked",
diff --git a/app/splash.c b/app/splash.c
index 08f6981..e93036f 100644
--- a/app/splash.c
+++ b/app/splash.c
@@ -1,6 +1,5 @@
 #include <config.h>
 
-#undef GTK_DISABLE_DEPRECATED /* gtk_pixmap_new */
 #include <gtk/gtk.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
@@ -21,13 +20,7 @@ get_logo_pixmap (void)
   g_free(datadir);
 
   if (logo) {
-    GdkPixmap *pixmap;
-    GdkBitmap *bitmap;
-
-    gdk_pixbuf_render_pixmap_and_mask(logo, &pixmap, &bitmap, 128);
-    gpixmap = gtk_pixmap_new(pixmap, bitmap);
-    g_object_unref(pixmap);
-    if (bitmap) g_object_unref(bitmap);
+    gpixmap = gtk_image_new_from_pixbuf (logo);
     g_object_unref (logo);
   }
   return gpixmap;
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index e4978c4..4e55917 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -23,7 +23,7 @@
  * \ingroup diawidgets
  */
 #include <config.h>
-#undef GTK_DISABLE_DEPRECATED /* GtkDestroyNotify */
+
 #include <gtk/gtk.h>
 #include "intl.h"
 #include "widgets.h"
@@ -457,7 +457,7 @@ dia_arrow_chooser_new(gboolean left, DiaChangeArrowCallback callback,
   menu = gtk_menu_new();
   g_object_ref_sink(menu);
   g_object_set_data_full(G_OBJECT(chooser), button_menu_key, menu,
-			 (GtkDestroyNotify)g_object_unref);
+			 (GDestroyNotify)g_object_unref);
   /* although from ARROW_NONE to MAX_ARROW_TYPE-1 this is sorted by *index* to keep the order consistent with earlier releases */
   for (i = ARROW_NONE; i < MAX_ARROW_TYPE; ++i) {
     ArrowType arrow_type = arrow_type_from_index(i);
diff --git a/makefile.msc b/makefile.msc
index 1abac9d..9535a42 100644
--- a/makefile.msc
+++ b/makefile.msc
@@ -295,3 +295,7 @@ faq:
 	$(WGET) -O faqwiki.html http://live.gnome.org/Dia/Faq
 	$(SED) -f ..\..\..\..\installer\win32\wikifaq2installerfaq.sed faqwiki.html > faq.html
 	DEL faqwiki.html
+
+changes:
+	echo # Generated by Makefile. Do not edit. > ChangeLog.tmp
+	git log --since=2009-04-15 --date=short --pretty=format:" * %ad  %an  <%ae>  %t%n%n    %%s%n%n%b" >> ChangeLog.tmp
diff --git a/objects/AADL/edit_port_declaration.c b/objects/AADL/edit_port_declaration.c
index 6d35bb3..fcc9171 100755
--- a/objects/AADL/edit_port_declaration.c
+++ b/objects/AADL/edit_port_declaration.c
@@ -20,7 +20,6 @@
 
 #include <config.h>
 
-#undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 #include <string.h>
 #include "aadl.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]