[gtk+/parasite: 3/4] parasite: Make it build cleanly
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/parasite: 3/4] parasite: Make it build cleanly
- Date: Sat, 3 May 2014 03:47:13 +0000 (UTC)
commit 575956dbb78f88e01280653c5b605cd5dedffc0e
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 2 23:43:14 2014 -0400
parasite: Make it build cleanly
Fix deprecation warnings and the like.
modules/other/parasite/action-list.c | 3 +
modules/other/parasite/inspect-button.c | 69 +++++++++++------------
modules/other/parasite/prop-list.c | 2 +-
modules/other/parasite/property-cell-renderer.c | 2 +-
modules/other/parasite/widget-tree.c | 16 +++---
modules/other/parasite/window.c | 15 ++---
6 files changed, 51 insertions(+), 56 deletions(-)
---
diff --git a/modules/other/parasite/action-list.c b/modules/other/parasite/action-list.c
index 275bde5..c0eb2bc 100644
--- a/modules/other/parasite/action-list.c
+++ b/modules/other/parasite/action-list.c
@@ -20,6 +20,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
#include "action-list.h"
#include "parasite.h"
diff --git a/modules/other/parasite/inspect-button.c b/modules/other/parasite/inspect-button.c
index 6ae4826..5bbcf27 100644
--- a/modules/other/parasite/inspect-button.c
+++ b/modules/other/parasite/inspect-button.c
@@ -26,10 +26,10 @@
static void
on_inspect_widget (GtkWidget *grab_window,
- GdkEventButton *event,
+ GdkEventButton *event,
ParasiteWindow *parasite)
{
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event->device, event->time);
gtk_widget_hide (parasite->highlight_window);
if (parasite->selected_window != NULL)
@@ -38,18 +38,18 @@ on_inspect_widget (GtkWidget *grab_window,
GtkWidget *widget = NULL;
gdk_window_get_user_data (gdk_window_get_toplevel (parasite->selected_window),
- (gpointer *)&toplevel);
+ (gpointer *)&toplevel);
gdk_window_get_user_data (parasite->selected_window,
- (gpointer *)&widget);
+ (gpointer *)&widget);
if (toplevel)
- parasite_widget_tree_scan (PARASITE_WIDGET_TREE (parasite->widget_tree),
+ parasite_widget_tree_scan (PARASITE_WIDGET_TREE (parasite->widget_tree),
toplevel);
if (widget)
- parasite_widget_tree_select_widget (PARASITE_WIDGET_TREE (parasite->widget_tree),
- widget);
+ parasite_widget_tree_select_widget (PARASITE_WIDGET_TREE (parasite->widget_tree),
+ widget);
}
}
@@ -57,41 +57,36 @@ static void
on_highlight_window_show (GtkWidget *window,
ParasiteWindow *parasite)
{
- if (gtk_widget_is_composited (parasite->window))
- gtk_window_set_opacity (GTK_WINDOW (parasite->highlight_window), 0.2);
- else
- {
- /*
- * TODO: Do something different when there's no compositing manager.
- * Draw a border or something.
- */
- }
+ gtk_widget_set_opacity (parasite->highlight_window, 0.2);
}
static void
ensure_highlight_window (ParasiteWindow *parasite)
{
- GdkColor color;
+ GdkRGBA color;
if (parasite->highlight_window != NULL)
return;
- color.red = 0;
- color.green = 0;
- color.blue = 65535;
+ color.red = 0.0;
+ color.green = 0.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
parasite->highlight_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_modify_bg (parasite->highlight_window, GTK_STATE_NORMAL, &color);
+ gtk_widget_override_background_color (parasite->highlight_window, 0, &color);
g_signal_connect (G_OBJECT (parasite->highlight_window), "show",
- G_CALLBACK (on_highlight_window_show), parasite);
+ G_CALLBACK (on_highlight_window_show), parasite);
}
static void
on_highlight_widget (GtkWidget *grab_window,
- GdkEventMotion *event,
+ GdkEventMotion *event,
ParasiteWindow *parasite)
{
+ GdkDisplay *display;
+ GdkDevice *device;
GdkWindow *selected_window;
gint x, y, width, height;
@@ -99,9 +94,9 @@ on_highlight_widget (GtkWidget *grab_window,
gtk_widget_hide (parasite->highlight_window);
- selected_window =
- gdk_display_get_window_at_pointer (gtk_widget_get_display (grab_window),
- NULL, NULL);
+ display = gtk_widget_get_display (grab_window);
+ device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
+ selected_window = gdk_device_get_window_at_position (device, NULL, NULL);
if (selected_window == NULL)
{
@@ -129,7 +124,7 @@ on_highlight_widget (GtkWidget *grab_window,
static void
on_inspect_button_release (GtkWidget *button,
- GdkEventButton *event,
+ GdkEventButton *event,
ParasiteWindow *parasite)
{
GdkCursor *cursor;
@@ -148,15 +143,17 @@ on_inspect_button_release (GtkWidget *button,
gtk_widget_add_events (parasite->grab_window, events);
g_signal_connect (G_OBJECT (parasite->grab_window), "button_release_event",
- G_CALLBACK (on_inspect_widget), parasite);
+ G_CALLBACK (on_inspect_widget), parasite);
g_signal_connect (G_OBJECT (parasite->grab_window), "motion_notify_event",
- G_CALLBACK (on_highlight_widget), parasite);
+ G_CALLBACK (on_highlight_widget), parasite);
}
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (button), GDK_CROSSHAIR);
- gdk_pointer_grab (gtk_widget_get_window (parasite->grab_window), FALSE,
- events, NULL, cursor, event->time);
- gdk_cursor_unref (cursor);
+ gdk_device_grab (event->device,
+ gtk_widget_get_window (parasite->grab_window),
+ GDK_OWNERSHIP_WINDOW, FALSE,
+ events, cursor, event->time);
+ g_object_unref (cursor);
}
GtkWidget *
@@ -166,7 +163,7 @@ gtkparasite_inspect_button_new (ParasiteWindow *parasite)
button = gtk_button_new_with_label ("Inspect");
g_signal_connect (G_OBJECT (button), "button_release_event",
- G_CALLBACK (on_inspect_button_release), parasite);
+ G_CALLBACK (on_inspect_button_release), parasite);
return button;
}
@@ -185,9 +182,9 @@ on_flash_timeout (ParasiteWindow *parasite)
if (parasite->flash_count % 2 == 0)
{
if (gtk_widget_get_visible (parasite->highlight_window))
- gtk_widget_hide (parasite->highlight_window);
+ gtk_widget_hide (parasite->highlight_window);
else
- gtk_widget_show (parasite->highlight_window);
+ gtk_widget_show (parasite->highlight_window);
}
return TRUE;
@@ -222,7 +219,7 @@ gtkparasite_flash_widget (ParasiteWindow *parasite,
gtk_widget_show (parasite->highlight_window);
if (parasite->flash_cnx != 0)
- g_source_remove (parasite->flash_cnx);
+ g_source_remove (parasite->flash_cnx);
parasite->flash_count = 0;
parasite->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, parasite);
diff --git a/modules/other/parasite/prop-list.c b/modules/other/parasite/prop-list.c
index 3c9a638..9fa4c10 100644
--- a/modules/other/parasite/prop-list.c
+++ b/modules/other/parasite/prop-list.c
@@ -222,7 +222,7 @@ parasite_proplist_set_widget (ParasitePropList *proplist,
gtk_list_store_append (proplist->priv->model, &iter);
parasite_prop_list_update_prop (proplist, &iter, prop);
- g_hash_table_insert (proplist->priv->prop_iters, prop->name,
+ g_hash_table_insert (proplist->priv->prop_iters, (gpointer)prop->name,
gtk_tree_iter_copy (&iter));
/* Listen for updates */
diff --git a/modules/other/parasite/property-cell-renderer.c b/modules/other/parasite/property-cell-renderer.c
index 37b6272..1f6052d 100644
--- a/modules/other/parasite/property-cell-renderer.c
+++ b/modules/other/parasite/property-cell-renderer.c
@@ -299,7 +299,7 @@ parasite_property_cell_renderer_start_editing (GtkCellRenderer *renderer,
font_desc = pango_font_description_new ();
pango_font_description_set_size (font_desc, 8 * PANGO_SCALE);
- gtk_widget_modify_font (GTK_WIDGET (editable), font_desc);
+ gtk_widget_override_font (GTK_WIDGET (editable), font_desc);
pango_font_description_free (font_desc);
g_value_unset (&gvalue);
diff --git a/modules/other/parasite/widget-tree.c b/modules/other/parasite/widget-tree.c
index 30fa753..5e1ba44 100644
--- a/modules/other/parasite/widget-tree.c
+++ b/modules/other/parasite/widget-tree.c
@@ -115,7 +115,7 @@ on_toggle_realize (GtkCellRendererToggle *toggle,
WIDGET_REALIZED, gtk_widget_realize, gtk_widget_unrealize);
}
-
+#if 0
static void
on_toggle_visible (GtkCellRendererToggle *toggle,
gchar *path_str,
@@ -138,7 +138,7 @@ on_toggle_map (GtkCellRendererToggle *toggle,
PARASITE_WIDGET_TREE (treeview),
WIDGET_MAPPED, gtk_widget_map, gtk_widget_unmap);
}
-
+#endif
static void
parasite_widget_tree_init (ParasiteWidgetTree *widget_tree,
@@ -339,7 +339,6 @@ append_widget (GtkTreeStore *model,
const gchar *class_name = G_OBJECT_CLASS_NAME (GTK_WIDGET_GET_CLASS (widget));
const gchar *name;
const gchar *row_color;
- GdkWindow *window;
gchar *window_info;
gchar *address;
gboolean realized;
@@ -359,19 +358,20 @@ append_widget (GtkTreeStore *model,
name = "";
}
- window = gtk_widget_get_window (widget);
+#if 0
if (window_info)
{
+ GdkWindow *window;
#if HAVE_X11
+ window = gtk_widget_get_window (widget);
window_info = g_strdup_printf ("%p (XID 0x%x)", window, (gint) GDK_WINDOW_XID (window));
#else
window_info = g_strdup ("");
#endif
}
else
- {
- window_info = g_strdup ("");
- }
+#endif
+ window_info = g_strdup ("");
address = g_strdup_printf ("%p", widget);
@@ -404,7 +404,7 @@ append_widget (GtkTreeStore *model,
children = gtk_container_get_children (GTK_CONTAINER (widget));
for (l = children; l != NULL; l = l->next)
append_widget (model, GTK_WIDGET (l->data), &iter);
- g_free (children);
+ g_list_free (children);
}
}
diff --git a/modules/other/parasite/window.c b/modules/other/parasite/window.c
index 7f6804d..b750511 100644
--- a/modules/other/parasite/window.c
+++ b/modules/other/parasite/window.c
@@ -25,9 +25,6 @@
#include "prop-list.h"
#include "widget-tree.h"
-#include "config.h"
-
-
static void
on_widget_tree_selection_changed (ParasiteWidgetTree *widget_tree,
ParasiteWindow *parasite)
@@ -114,15 +111,13 @@ create_widget_tree (ParasiteWindow *parasite)
GtkWidget *swin;
GtkWidget *hpaned;
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- bbox = gtk_hbutton_box_new ();
+ bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (bbox);
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
- gtk_box_set_spacing (GTK_BOX (bbox), 6);
button = gtkparasite_inspect_button_new (parasite);
gtk_widget_show (button);
@@ -142,7 +137,7 @@ create_widget_tree (ParasiteWindow *parasite)
g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (on_show_graphic_updates_toggled), parasite);
- hpaned = gtk_hpaned_new ();
+ hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (hpaned);
gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
@@ -163,7 +158,7 @@ create_action_list (ParasiteWindow *parasite)
GtkWidget *vbox;
GtkWidget *swin;
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
@@ -202,7 +197,7 @@ gtkparasite_window_create (void)
gtk_window_set_title (GTK_WINDOW (window->window), title);
g_free (title);
- vpaned = gtk_vpaned_new ();
+ vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_widget_show (vpaned);
gtk_container_add (GTK_CONTAINER (window->window), vpaned);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]