[ekiga] Fixed gtk+ deprecated api uses



commit d66e9e8682c48b895198bb4c4080acef78e9e4bd
Author: Julien Puydt <jpuydt free fr>
Date:   Fri Jun 21 21:44:06 2013 +0200

    Fixed gtk+ deprecated api uses
    
    The bitext cell renderer doesn't look perfect,
    but it looks the same as before my change... and I still haven't
    found how to make it look better.

 lib/engine/gui/gtk-core/codecsbox.cpp              |    2 +-
 lib/engine/gui/gtk-core/codecsbox.h                |    4 +-
 lib/engine/gui/gtk-frontend/chat-area.cpp          |    6 ++++-
 lib/engine/gui/gtk-frontend/chat-area.h            |    4 +-
 lib/engine/gui/gtk-frontend/multiple-chat-page.cpp |    2 +-
 lib/engine/gui/gtk-frontend/multiple-chat-page.h   |    4 +-
 lib/engine/gui/gtk-frontend/preferences-window.cpp |    6 ++--
 lib/engine/gui/gtk-frontend/presentity-view.cpp    |    2 +-
 lib/engine/gui/gtk-frontend/presentity-view.h      |    4 +-
 lib/engine/gui/gtk-frontend/simple-chat-page.cpp   |    6 +++-
 lib/engine/gui/gtk-frontend/simple-chat-page.h     |    4 +-
 lib/engine/gui/gtk-frontend/statusicon.cpp         |    6 ++--
 lib/gui/gm-cell-renderer-bitext.c                  |   25 +++++++++----------
 13 files changed, 40 insertions(+), 35 deletions(-)
---
diff --git a/lib/engine/gui/gtk-core/codecsbox.cpp b/lib/engine/gui/gtk-core/codecsbox.cpp
index df1a7d8..6e771fe 100644
--- a/lib/engine/gui/gtk-core/codecsbox.cpp
+++ b/lib/engine/gui/gtk-core/codecsbox.cpp
@@ -63,7 +63,7 @@ struct _CodecsBoxPrivate
 
 enum { TYPE = 1 };
 
-G_DEFINE_TYPE (CodecsBox, codecs_box, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (CodecsBox, codecs_box, GTK_TYPE_BOX);
 
 /* Static functions */
 static void codecs_box_set_codecs (CodecsBox *self,
diff --git a/lib/engine/gui/gtk-core/codecsbox.h b/lib/engine/gui/gtk-core/codecsbox.h
index 3a9b945..a40998b 100644
--- a/lib/engine/gui/gtk-core/codecsbox.h
+++ b/lib/engine/gui/gtk-core/codecsbox.h
@@ -62,7 +62,7 @@ typedef struct _CodecsBoxClass CodecsBoxClass;
 
 struct _CodecsBox
 {
-  GtkHBox parent;
+  GtkBox parent;
 
   CodecsBoxPrivate *priv;
 };
@@ -70,7 +70,7 @@ struct _CodecsBox
 
 struct _CodecsBoxClass
 {
-  GtkHBoxClass parent_class;
+  GtkBoxClass parent_class;
 };
 
 
diff --git a/lib/engine/gui/gtk-frontend/chat-area.cpp b/lib/engine/gui/gtk-frontend/chat-area.cpp
index cc7e6e1..af4c244 100644
--- a/lib/engine/gui/gtk-frontend/chat-area.cpp
+++ b/lib/engine/gui/gtk-frontend/chat-area.cpp
@@ -75,7 +75,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (ChatArea, chat_area, GTK_TYPE_VPANED);
+G_DEFINE_TYPE (ChatArea, chat_area, GTK_TYPE_PANED);
 
 /* declaration of internal api */
 
@@ -677,6 +677,10 @@ chat_area_init (ChatArea* self)
   GtkWidget *frame = NULL;
   GtkWidget *sep = NULL;
 
+  g_object_set (G_OBJECT (self),
+               "orientation", GTK_ORIENTATION_VERTICAL,
+               NULL);
+
   self->priv = new ChatAreaPrivate;
 
   /* first the area has a text view to display
diff --git a/lib/engine/gui/gtk-frontend/chat-area.h b/lib/engine/gui/gtk-frontend/chat-area.h
index 21d33ae..7cbe920 100644
--- a/lib/engine/gui/gtk-frontend/chat-area.h
+++ b/lib/engine/gui/gtk-frontend/chat-area.h
@@ -50,14 +50,14 @@ typedef struct _ChatAreaPrivate ChatAreaPrivate;
 
 struct _ChatArea
 {
-  GtkVPaned parent;
+  GtkPaned parent;
 
   ChatAreaPrivate* priv;
 };
 
 struct _ChatAreaClass
 {
-  GtkVPanedClass parent;
+  GtkPanedClass parent;
 
   /* this is the "message-notice-event" signal */
   void (*message_notice_event) (ChatArea* self);
diff --git a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp 
b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
index 1501226..0cc1d9b 100644
--- a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
+++ b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
@@ -42,7 +42,7 @@ struct _MultipleChatPagePrivate {
   GtkWidget* area;
 };
 
-G_DEFINE_TYPE (MultipleChatPage, multiple_chat_page, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (MultipleChatPage, multiple_chat_page, GTK_TYPE_BOX);
 
 static void on_page_grab_focus (GtkWidget*,
                                gpointer);
diff --git a/lib/engine/gui/gtk-frontend/multiple-chat-page.h 
b/lib/engine/gui/gtk-frontend/multiple-chat-page.h
index cb6aa36..a791069 100644
--- a/lib/engine/gui/gtk-frontend/multiple-chat-page.h
+++ b/lib/engine/gui/gtk-frontend/multiple-chat-page.h
@@ -54,13 +54,13 @@ typedef struct _MultipleChatPagePrivate MultipleChatPagePrivate;
 typedef struct _MultipleChatPageClass MultipleChatPageClass;
 
 struct _MultipleChatPage {
-  GtkHBox parent;
+  GtkBox parent;
 
   MultipleChatPagePrivate* priv;
 };
 
 struct _MultipleChatPageClass {
-  GtkHBoxClass parent_class;
+  GtkBoxClass parent_class;
 };
 
 #define TYPE_MULTIPLE_CHAT_PAGE             (multiple_chat_page_get_type())
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp 
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index e409045..d1e22e8 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -1175,9 +1175,9 @@ preferences_window_new (Ekiga::ServiceCore& core)
   g_object_set_data_full (G_OBJECT (window), "window_name",
                          g_strdup ("preferences_window"), g_free);
   gtk_window_set_title (GTK_WINDOW (window), _("Ekiga Preferences"));
-  pixbuf = gtk_widget_render_icon (GTK_WIDGET (window),
-                                  GTK_STOCK_PREFERENCES,
-                                  GTK_ICON_SIZE_MENU, NULL);
+  pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (window),
+                                         GTK_STOCK_PREFERENCES,
+                                         GTK_ICON_SIZE_MENU);
   gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
   gtk_widget_realize (GTK_WIDGET (window));
   g_object_unref (pixbuf);
diff --git a/lib/engine/gui/gtk-frontend/presentity-view.cpp b/lib/engine/gui/gtk-frontend/presentity-view.cpp
index d05ff8a..daab0c2 100644
--- a/lib/engine/gui/gtk-frontend/presentity-view.cpp
+++ b/lib/engine/gui/gtk-frontend/presentity-view.cpp
@@ -52,7 +52,7 @@ enum {
   PRESENTITY_VIEW_PROP_PRESENTITY = 1
 };
 
-G_DEFINE_TYPE (PresentityView, presentity_view, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (PresentityView, presentity_view, GTK_TYPE_BOX);
 
 /* declaration of callbacks */
 
diff --git a/lib/engine/gui/gtk-frontend/presentity-view.h b/lib/engine/gui/gtk-frontend/presentity-view.h
index e0eb8df..9f73f23 100644
--- a/lib/engine/gui/gtk-frontend/presentity-view.h
+++ b/lib/engine/gui/gtk-frontend/presentity-view.h
@@ -50,14 +50,14 @@ typedef struct _PresentityViewClass PresentityViewClass;
 
 struct _PresentityView
 {
-  GtkHBox parent;
+  GtkBox parent;
 
   PresentityViewPrivate* priv;
 };
 
 struct _PresentityViewClass
 {
-  GtkHBoxClass parent;
+  GtkBoxClass parent;
 };
 
 /* public api */
diff --git a/lib/engine/gui/gtk-frontend/simple-chat-page.cpp 
b/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
index 34c94ce..3aeb37d 100644
--- a/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
+++ b/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
@@ -50,7 +50,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (SimpleChatPage, simple_chat_page, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (SimpleChatPage, simple_chat_page, GTK_TYPE_BOX);
 
 static void on_page_grab_focus (GtkWidget*,
                                gpointer);
@@ -119,7 +119,9 @@ simple_chat_page_new (Ekiga::SimpleChatPtr chat)
   GtkWidget* presentity_view = NULL;
   GtkWidget* area = NULL;
 
-  result = (SimpleChatPage*)g_object_new (TYPE_SIMPLE_CHAT_PAGE, NULL);
+  result = (SimpleChatPage*)g_object_new (TYPE_SIMPLE_CHAT_PAGE,
+                                         "orientation", GTK_ORIENTATION_VERTICAL,
+                                         NULL);
 
   presentity_view = presentity_view_new (chat->get_presentity ());
   gtk_box_pack_start (GTK_BOX (result), presentity_view,
diff --git a/lib/engine/gui/gtk-frontend/simple-chat-page.h b/lib/engine/gui/gtk-frontend/simple-chat-page.h
index 016ab38..09b63ab 100644
--- a/lib/engine/gui/gtk-frontend/simple-chat-page.h
+++ b/lib/engine/gui/gtk-frontend/simple-chat-page.h
@@ -54,13 +54,13 @@ typedef struct _SimpleChatPagePrivate SimpleChatPagePrivate;
 typedef struct _SimpleChatPageClass SimpleChatPageClass;
 
 struct _SimpleChatPage {
-  GtkVBox parent;
+  GtkBox parent;
 
   SimpleChatPagePrivate* priv;
 };
 
 struct _SimpleChatPageClass {
-  GtkVBoxClass parent_class;
+  GtkBoxClass parent_class;
 
   /* this is the "message-notice-event" signal */
   void (*message_notice_event) (SimpleChatPage* self);
diff --git a/lib/engine/gui/gtk-frontend/statusicon.cpp b/lib/engine/gui/gtk-frontend/statusicon.cpp
index abd2b3f..0c61cbc 100644
--- a/lib/engine/gui/gtk-frontend/statusicon.cpp
+++ b/lib/engine/gui/gtk-frontend/statusicon.cpp
@@ -454,9 +454,9 @@ statusicon_on_notification_added (boost::shared_ptr<Ekiga::Notification> notific
                                   gpointer data)
 {
   StatusIcon *self = STATUSICON (data);
-  GdkPixbuf* pixbuf = gtk_widget_render_icon (self->priv->chat_window,
-                                             GTK_STOCK_DIALOG_WARNING,
-                                             GTK_ICON_SIZE_MENU, NULL);
+  GdkPixbuf* pixbuf = gtk_widget_render_icon_pixbuf (self->priv->chat_window,
+                                                    GTK_STOCK_DIALOG_WARNING,
+                                                    GTK_ICON_SIZE_MENU);
 
   gchar *current_tooltip = gtk_status_icon_get_tooltip_text (GTK_STATUS_ICON (self));
   gchar *tooltip = NULL;
diff --git a/lib/gui/gm-cell-renderer-bitext.c b/lib/gui/gm-cell-renderer-bitext.c
index 9ed4197..e8c52e5 100644
--- a/lib/gui/gm-cell-renderer-bitext.c
+++ b/lib/gui/gm-cell-renderer-bitext.c
@@ -68,31 +68,30 @@ gm_cell_renderer_bitext_update_text (GmCellRendererBitext *renderer,
                                     GtkWidget *widget,
                                     gboolean is_selected)
 {
-  GtkStyle *style = NULL;
+  GtkStateFlags state = GTK_STATE_FLAG_NORMAL;
+  GtkStyleContext *style = NULL;
   PangoAttrList *attr_list = NULL;
-  GdkColor color;
+  GdkRGBA color;
   PangoAttribute *attr_color = NULL;
   PangoAttribute *attr_size = NULL;
+  const PangoFontDescription* font = NULL;
   gchar *str = NULL;
 
   if (renderer->priv->is_valid && renderer->priv->is_selected == is_selected)
     return;
 
-  style = gtk_widget_get_style (widget);
+  style = gtk_widget_get_style_context (widget);
 
-  attr_list = pango_attr_list_new ();
-  if (!is_selected) {
-
-    color = style->text_aa[GTK_STATE_NORMAL];
+  if (is_selected)
+    state = GTK_STATE_FLAG_SELECTED;
 
-    attr_color = pango_attr_foreground_new (color.red, color.green, color.blue);
-    attr_color->start_index = strlen (renderer->priv->primary_text) + 1;
-    attr_color->end_index = (guint) - 1;
-    pango_attr_list_insert (attr_list, attr_color);
-  }
+  attr_list = pango_attr_list_new ();
 
   /* we want the secondary text smaller */
-  attr_size = pango_attr_size_new ((int) (pango_font_description_get_size (style->font_desc) * 0.8));
+  gtk_style_context_get (style, state,
+                        "font", &font,
+                        NULL);
+  attr_size = pango_attr_size_new ((int) (pango_font_description_get_size (font) * 0.8));
   attr_size->start_index = strlen (renderer->priv->primary_text) + 1;
   attr_size->end_index = (guint) - 1;
   pango_attr_list_insert (attr_list, attr_size);


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