summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-03-23 01:52:45 +0000
committerjstebbins <[email protected]>2011-03-23 01:52:45 +0000
commite63bdc7ee302f04c359f20c20fda35f0c16bcb5c (patch)
tree35edd86c34d50408c04e89b726edde72bf0a38c4
parent475cc7a8353d426faf06095a263560eee0ed7e7f (diff)
LinGui: a few more random deprecated functions and macros removed
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3875 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/src/callbacks.c6
-rw-r--r--gtk/src/ghbcellrenderertext.c62
-rw-r--r--gtk/src/ghbcellrenderertext.h2
-rw-r--r--gtk/src/ghbcompositor.c51
-rw-r--r--gtk/src/ghbcompositor.h2
5 files changed, 52 insertions, 71 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index aead002b3..fc79b99cf 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -20,6 +20,9 @@
#include <sys/stat.h>
#include <time.h>
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+
#if !defined(_WIN32)
#include <poll.h>
#define G_UDEV_API_IS_SUBJECT_TO_CHANGE 1
@@ -52,9 +55,6 @@
#include <dbt.h>
#endif
-#include <glib/gstdio.h>
-#include <gio/gio.h>
-
#include "hb.h"
#include "callbacks.h"
#include "queuehandler.h"
diff --git a/gtk/src/ghbcellrenderertext.c b/gtk/src/ghbcellrenderertext.c
index 3876fb31c..c198a5214 100644
--- a/gtk/src/ghbcellrenderertext.c
+++ b/gtk/src/ghbcellrenderertext.c
@@ -1519,13 +1519,10 @@ get_size (GtkCellRenderer *cell,
gint cell_width, cell_height, cell_xpad, cell_ypad;
gfloat cell_xalign, cell_yalign;
- g_object_get(cell,
- "width", &cell_width,
- "height", &cell_height,
- "xpad", &cell_xpad,
- "ypad", &cell_ypad,
- "xalign", &cell_xalign,
- "yalign", &cell_yalign, NULL);
+
+ gtk_cell_renderer_get_fixed_size(cell, &cell_width, &cell_height);
+ gtk_cell_renderer_get_alignment(cell, &cell_xalign, &cell_yalign);
+ gtk_cell_renderer_get_padding(cell, &cell_xpad, &cell_ypad);
if (celltext->calc_fixed_height)
{
@@ -1571,43 +1568,19 @@ get_size (GtkCellRenderer *cell,
else
layout = get_layout (celltext, widget, FALSE, 0);
- pango_layout_get_extents (layout, NULL, &rect);
- pango_extents_to_pixels (&rect, NULL);
-
- if (height)
- *height = cell_ypad * 2 + rect.height;
-
- /* The minimum size for ellipsized labels is ~ 3 chars */
- if (width)
- {
- if (priv->ellipsize || priv->width_chars > 0)
- {
- PangoContext *context;
- PangoFontMetrics *metrics;
- gint char_width;
-
- context = pango_layout_get_context (layout);
- metrics = pango_context_get_metrics (context, widget->style->font_desc, pango_context_get_language (context));
-
- char_width = pango_font_metrics_get_approximate_char_width (metrics);
- pango_font_metrics_unref (metrics);
-
- *width = cell_xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
- }
- else
- {
- *width = cell_xpad * 2 + rect.x + rect.width;
- }
- }
+ pango_layout_get_pixel_extents(layout, NULL, &rect);
if (cell_area)
{
+ rect.height = MIN(rect.height, cell_area->height - 2 * cell_ypad);
+ rect.width = MIN(rect.width, cell_area->width - 2 * cell_xpad);
+
if (x_offset)
{
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- *x_offset = (1.0 - cell_xalign) * (cell_area->width - (rect.x + rect.width + (2 * cell_xpad)));
+ *x_offset = (1.0 - cell_xalign) * (cell_area->width - (2 * cell_xpad));
else
- *x_offset = cell_xalign * (cell_area->width - (rect.x + rect.width + (2 * cell_xpad)));
+ *x_offset = cell_xalign * (cell_area->width - (2 * cell_xpad));
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
*x_offset = MAX(*x_offset, 0);
@@ -1624,6 +1597,12 @@ get_size (GtkCellRenderer *cell,
if (y_offset) *y_offset = 0;
}
+ if (height)
+ *height = cell_ypad * 2 + rect.height;
+
+ if (width)
+ *width = cell_xpad * 2 + rect.width;
+
g_object_unref (layout);
}
@@ -1665,11 +1644,8 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
gboolean sensitive;
gint xpad, ypad;
- g_object_get(cell,
- "sensitive", &sensitive,
- "xpad", &xpad,
- "ypad", &ypad,
- NULL);
+
+ sensitive = gtk_cell_renderer_get_sensitive(cell);
if (!sensitive)
{
state = GTK_STATE_INSENSITIVE;
@@ -1694,6 +1670,8 @@ ghb_cell_renderer_text_render (GtkCellRenderer *cell,
state = GTK_STATE_NORMAL;
}
+ gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
+
if (celltext->background_set &&
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
diff --git a/gtk/src/ghbcellrenderertext.h b/gtk/src/ghbcellrenderertext.h
index 0e12ba17a..ab178ce91 100644
--- a/gtk/src/ghbcellrenderertext.h
+++ b/gtk/src/ghbcellrenderertext.h
@@ -21,7 +21,7 @@
#define __GHB_CELL_RENDERER_TEXT_H__
#include <pango/pango.h>
-#include <gtk/gtkcellrenderer.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
diff --git a/gtk/src/ghbcompositor.c b/gtk/src/ghbcompositor.c
index 4839fa786..5506975d4 100644
--- a/gtk/src/ghbcompositor.c
+++ b/gtk/src/ghbcompositor.c
@@ -276,7 +276,7 @@ ghb_compositor_get_child_property(
static void
ghb_compositor_init (GhbCompositor *compositor)
{
- GTK_WIDGET_UNSET_FLAGS (compositor, GTK_NO_WINDOW);
+ gtk_widget_set_has_window(GTK_WIDGET(compositor), TRUE);
}
GtkWidget*
@@ -310,7 +310,7 @@ showtype(const gchar *msg, GtkWidget *widget)
static GList*
find_drawables(GList *drawables, GtkWidget *widget)
{
- if (!GTK_WIDGET_NO_WINDOW(widget))
+ if (gtk_widget_get_has_window(widget))
{
drawables = g_list_append(drawables, widget);
return drawables;
@@ -323,7 +323,7 @@ find_drawables(GList *drawables, GtkWidget *widget)
// Look for a child with a window
for (link = children; link != NULL; link = link->next)
{
- if (!GTK_WIDGET_NO_WINDOW(GTK_WIDGET(link->data)))
+ if (gtk_widget_get_has_window(GTK_WIDGET(link->data)))
{
drawables = g_list_append(drawables, link->data);
}
@@ -360,7 +360,7 @@ ghb_compositor_zlist_insert (
g_return_if_fail (GHB_IS_COMPOSITOR (compositor));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent(child) == NULL);
gtk_widget_set_parent(child, GTK_WIDGET(compositor));
@@ -472,14 +472,17 @@ ghb_compositor_realize (GtkWidget *widget)
gint border_width;
gboolean visible_window;
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized(widget, TRUE);
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width(GTK_CONTAINER (widget));
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = widget->allocation.width - 2*border_width;
- attributes.height = widget->allocation.height - 2*border_width;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+
+ attributes.x = allocation.x + border_width;
+ attributes.y = allocation.y + border_width;
+ attributes.width = allocation.width - 2*border_width;
+ attributes.height = allocation.height - 2*border_width;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
@@ -489,7 +492,7 @@ ghb_compositor_realize (GtkWidget *widget)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK;
- visible_window = !GTK_WIDGET_NO_WINDOW (widget);
+ visible_window = gtk_widget_get_has_window(widget);
GdkWindow *window;
if (visible_window)
@@ -548,8 +551,8 @@ ghb_compositor_size_request(
}
}
- requisition->width = width + GTK_CONTAINER (widget)->border_width * 2;
- requisition->height = height + GTK_CONTAINER (widget)->border_width * 2;
+ requisition->width = width + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2;
+ requisition->height = height + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2;
}
static void
@@ -563,12 +566,12 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
widget->allocation = *allocation;
compositor = GHB_COMPOSITOR (widget);
- if (GTK_WIDGET_NO_WINDOW (widget))
+ if (!gtk_widget_get_has_window(widget))
{
child_allocation.x = allocation->x +
- GTK_CONTAINER(widget)->border_width;
+ gtk_container_get_border_width(GTK_CONTAINER(widget));
child_allocation.y = allocation->y +
- GTK_CONTAINER(widget)->border_width;
+ gtk_container_get_border_width(GTK_CONTAINER(widget));
}
else
{
@@ -577,17 +580,17 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
child_allocation.width = MAX (allocation->width -
- GTK_CONTAINER (widget)->border_width * 2, 0);
+ gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0);
child_allocation.height = MAX (allocation->height -
- GTK_CONTAINER (widget)->border_width * 2, 0);
+ gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0);
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized(widget))
{
- if (!GTK_WIDGET_NO_WINDOW (widget))
+ if (gtk_widget_get_has_window(widget))
{
gdk_window_move_resize (gtk_widget_get_window(widget),
- allocation->x + GTK_CONTAINER (widget)->border_width,
- allocation->y + GTK_CONTAINER (widget)->border_width,
+ allocation->x + gtk_container_get_border_width(GTK_CONTAINER (widget)),
+ allocation->y + gtk_container_get_border_width(GTK_CONTAINER (widget)),
child_allocation.width,
child_allocation.height);
}
@@ -595,7 +598,7 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
for (link = compositor->children; link != NULL; link = link->next)
{
cc = (GhbCompositorChild*)link->data;
- if (GTK_WIDGET_REALIZED (cc->widget))
+ if (gtk_widget_get_realized (cc->widget))
gtk_widget_size_allocate (cc->widget, &child_allocation);
}
}
@@ -650,7 +653,7 @@ ghb_compositor_expose (GtkWidget *widget, GdkEventExpose *event)
{
if (GTK_WIDGET_DRAWABLE (widget))
{
- if (!GTK_WIDGET_NO_WINDOW (widget))
+ if (gtk_widget_get_has_window(widget))
ghb_compositor_blend (widget, event);
GTK_WIDGET_CLASS(
diff --git a/gtk/src/ghbcompositor.h b/gtk/src/ghbcompositor.h
index 51cdc52c6..19d7fd6e5 100644
--- a/gtk/src/ghbcompositor.h
+++ b/gtk/src/ghbcompositor.h
@@ -28,7 +28,7 @@
#define __GHB_COMPOSITOR_H__
-#include <gtk/gtkbin.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS