[conglomerate] Remove deprecated usages



commit 2c5fe45993e47034931940bca5ffa59c1620964b
Author: P. F. Chimento <philip chimento gmail com>
Date:   Sat Aug 13 23:07:37 2011 +0200

    Remove deprecated usages
    
    This patch removes all deprecated GLib, GDK-Pixbuf, and GTK functions
    that were deprecated in GTK 2.20 or earlier.

 configure.ac                     |    2 +-
 src/cong-app.c                   |   18 -----------
 src/cong-app.h                   |    3 --
 src/cong-debug-log-view.c        |    2 +-
 src/cong-dom-view.c              |    2 +-
 src/cong-edit-find-and-replace.c |    4 +-
 src/cong-editor-area-expander.c  |    8 ++--
 src/cong-editor-widget3.c        |   62 +++++++++++++++++++------------------
 src/cong-eel.c                   |    2 +-
 src/cong-error-dialog.c          |    6 ++--
 src/cong-file-export.c           |    2 +-
 src/cong-primary-window.c        |   14 ++++-----
 src/cong-tree-view.c             |    8 ++--
 src/cong-util.c                  |    5 +--
 src/cursor.c                     |    4 +-
 15 files changed, 59 insertions(+), 83 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e569f67..2df91b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,7 @@ AM_GLIB_GNU_GETTEXT
 
 dnl --- Package configuration ---
 
-GTK2_REQUIRED=2.10.0
+GTK2_REQUIRED=2.20.0
 GIO_REQUIRED=2.20.0
 LIBXML_REQUIRED=2.0.0
 LIBXSLT_REQUIRED=1.0.0
diff --git a/src/cong-app.c b/src/cong-app.c
index 9e45898..e3a19fe 100644
--- a/src/cong-app.c
+++ b/src/cong-app.c
@@ -75,7 +75,6 @@ struct _CongAppPrivate
 #endif
 	CongDispspecRegistry* ds_registry;
 	GConfClient* gconf_client;
-	GtkTooltips *tooltips;
 	CongFont *fonts[CONG_FONT_ROLE_NUM];
 
 	CongSelectionData clipboard_selection;
@@ -839,21 +838,6 @@ cong_app_set_clipboard_from_xml_fragment (CongApp *app,
 }
 
 /**
- * cong_app_get_tooltips:
- * @app:
- *
- * TODO: Write me
- * Returns:
- */
-GtkTooltips*
-cong_app_get_tooltips (CongApp *app)
-{
-	g_return_val_if_fail (app, NULL);
-
-	return PRIVATE(app)->tooltips;
-}
-
-/**
  * cong_app_get_font:
  * @app:
  * @role:
@@ -998,8 +982,6 @@ cong_app_new (int   argc,
 
 	cong_app_private_load_fonts (app);
 
-	PRIVATE(app)->tooltips = gtk_tooltips_new();
-
 	/* Load stylesheets: */
 	{
 		gchar *stylesheet_file = cong_app_locate_file (app,
diff --git a/src/cong-app.h b/src/cong-app.h
index 226c8c2..c247d6f 100644
--- a/src/cong-app.h
+++ b/src/cong-app.h
@@ -65,9 +65,6 @@ cong_app_set_clipboard_from_xml_fragment (CongApp *app,
 					  const gchar* xml_fragment,
 					  CongDocument *source_doc);
 
-GtkTooltips*
-cong_app_get_tooltips (CongApp *app);
-
 CongFont*
 cong_app_get_font (CongApp *app,
 		   CongFontRole role);
diff --git a/src/cong-debug-log-view.c b/src/cong-debug-log-view.c
index f680291..b9543b2 100644
--- a/src/cong-debug-log-view.c
+++ b/src/cong-debug-log-view.c
@@ -480,7 +480,7 @@ make_window_etc(void)
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(details->scrolled_window), 
 				       GTK_POLICY_AUTOMATIC,
 				       GTK_POLICY_AUTOMATIC);
-	gtk_widget_set_usize(GTK_WIDGET(details->scrolled_window), 100, 50);
+	gtk_widget_set_size_request(GTK_WIDGET(details->scrolled_window), 100, 50);
 
         details->list_store = gtk_list_store_new (DEBUGLOGVIEW_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 	details->tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model (GTK_TREE_MODEL(details->list_store)));
diff --git a/src/cong-dom-view.c b/src/cong-dom-view.c
index 51b5feb..07c0f7b 100644
--- a/src/cong-dom-view.c
+++ b/src/cong-dom-view.c
@@ -81,7 +81,7 @@ cong_dom_view_new (CongDocument *doc,
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), 
 				       GTK_POLICY_AUTOMATIC,
 				       GTK_POLICY_AUTOMATIC);
-	gtk_widget_set_usize(GTK_WIDGET(scrolled_window), 100, 50);
+	gtk_widget_set_size_request(GTK_WIDGET(scrolled_window), 100, 50);
 
 	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), 
 					      GTK_WIDGET(cong_tree_view_get_widget(cong_tree_view)));
diff --git a/src/cong-edit-find-and-replace.c b/src/cong-edit-find-and-replace.c
index 9eead1e..40e7209 100644
--- a/src/cong-edit-find-and-replace.c
+++ b/src/cong-edit-find-and-replace.c
@@ -394,7 +394,7 @@ cong_document_find (CongDocument *doc)
 	if (!dialog)
 		return;
 
-	if (GTK_WIDGET_VISIBLE (dialog->dialog))
+	if (gtk_widget_get_visible (dialog->dialog))
 		return;
 
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->dialog), 
@@ -446,7 +446,7 @@ cong_document_replace (CongDocument *doc)
 	if (!dialog)
 		return;
 
-	if (GTK_WIDGET_VISIBLE (dialog->dialog))
+	if (gtk_widget_get_visible (dialog->dialog))
 		return;
 
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->dialog), 
diff --git a/src/cong-editor-area-expander.c b/src/cong-editor-area-expander.c
index f152b53..b61cb3e 100644
--- a/src/cong-editor-area-expander.c
+++ b/src/cong-editor-area-expander.c
@@ -240,7 +240,7 @@ on_button_press (CongEditorArea *editor_area,
 
 		if (PRIVATE(area_expander)->target_expander_style == PRIVATE(area_expander)->current_expander_style) {
 			if (PRIVATE(area_expander)->timeout_handler_id) {
-				gtk_timeout_remove (PRIVATE(area_expander)->timeout_handler_id);
+				g_source_remove (PRIVATE(area_expander)->timeout_handler_id);
 				PRIVATE(area_expander)->timeout_handler_id = 0;
 			}
 
@@ -249,9 +249,9 @@ on_button_press (CongEditorArea *editor_area,
 			
 		} else {
 			if (!PRIVATE(area_expander)->timeout_handler_id) {
-				PRIVATE(area_expander)->timeout_handler_id = gtk_timeout_add (10,
-											      on_timeout,
-											      area_expander);
+				PRIVATE(area_expander)->timeout_handler_id = g_timeout_add (10,
+				                                                            on_timeout,
+				                                                            area_expander);
 			}
 		}
 
diff --git a/src/cong-editor-widget3.c b/src/cong-editor-widget3.c
index cd1e173..856d983 100644
--- a/src/cong-editor-widget3.c
+++ b/src/cong-editor-widget3.c
@@ -350,39 +350,41 @@ cong_editor_widget3_construct (CongEditorWidget3 *editor_widget,
 	PRIVATE(editor_widget)->test_gc =  gdk_gc_new(cong_gui_get_a_window()->window);
 	
 	/* Connect to GtkWidget events: */
-	gtk_signal_connect(GTK_OBJECT(editor_widget), 
-			   "expose_event",
-			   (GtkSignalFunc) expose_event_handler, 
-			   NULL);
-	gtk_signal_connect(GTK_OBJECT(editor_widget), 
-			   "configure_event",
-			   (GtkSignalFunc) configure_event_handler, 
-			   NULL);
-	gtk_signal_connect(GTK_OBJECT(editor_widget), 
-			   "button_press_event",
-			   (GtkSignalFunc) button_press_event_handler, 
-			   NULL);
-	gtk_signal_connect(GTK_OBJECT(editor_widget), 
-			   "motion_notify_event",
-			   (GtkSignalFunc) motion_notify_event_handler, 
-			   NULL);
-	gtk_signal_connect_after(GTK_OBJECT(editor_widget), 
-				 "key_press_event",
-				 (GtkSignalFunc) key_press_event_handler, 
-				 NULL);
-	gtk_signal_connect_after(GTK_OBJECT(editor_widget), 
-				 "key_release_event",
-				 (GtkSignalFunc) key_release_event_handler, 
-				 NULL);
-	gtk_signal_connect(GTK_OBJECT(editor_widget),
- 			   "size-request",
- 			   (GtkSignalFunc) size_request_handler,
- 			   NULL);
+	g_signal_connect(editor_widget,
+	                 "expose_event",
+	                 G_CALLBACK(expose_event_handler),
+	                 NULL);
+	g_signal_connect(editor_widget,
+	                 "configure_event",
+	                 G_CALLBACK(configure_event_handler),
+	                 NULL);
+	g_signal_connect(editor_widget,
+	                 "button_press_event",
+	                 G_CALLBACK(button_press_event_handler),
+	                 NULL);
+	g_signal_connect(editor_widget,
+	                 "motion_notify_event",
+	                 G_CALLBACK(motion_notify_event_handler),
+	                 NULL);
+	g_signal_connect_after(editor_widget,
+	                       "key_press_event",
+	                       G_CALLBACK(key_press_event_handler),
+	                       NULL);
+	g_signal_connect_after(editor_widget,
+	                       "key_release_event",
+	                       G_CALLBACK(key_release_event_handler),
+	                       NULL);
+	g_signal_connect(editor_widget,
+	                 "size-request",
+	                 G_CALLBACK(size_request_handler),
+	                 NULL);
 
 	gtk_widget_set_events(GTK_WIDGET(editor_widget), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK);
 
-	gtk_widget_set(GTK_WIDGET(editor_widget), "can_focus", (gboolean) TRUE, NULL);
-	gtk_widget_set(GTK_WIDGET(editor_widget), "can_default", (gboolean) TRUE, NULL);
+	g_object_set(editor_widget,
+	             "can_focus", TRUE,
+	             "can_default", TRUE,
+	             NULL);
 
 	/* Set up GTK Input Method support: */
 	{
diff --git a/src/cong-eel.c b/src/cong-eel.c
index e6f3ebc..a9c0e19 100644
--- a/src/cong-eel.c
+++ b/src/cong-eel.c
@@ -357,7 +357,7 @@ cong_eel_draw_pixbuf (GdkDrawable *drawable,
 		      gint x_dither,
 		      gint y_dither)
 {
-#if 0
+#if 1
 	/* Code for Gdk-2.2 and later: */
 	gdk_draw_pixbuf (drawable,
 			 gc,
diff --git a/src/cong-error-dialog.c b/src/cong-error-dialog.c
index 6215af8..83ce0ca 100644
--- a/src/cong-error-dialog.c
+++ b/src/cong-error-dialog.c
@@ -112,12 +112,12 @@ cong_error_dialog_new(GtkWindow *parent_window,
 	gtk_widget_show (dialog_action_area1);
 	gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 5);
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
-	gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area1), 10);
+	gtk_box_set_spacing (GTK_BOX (dialog_action_area1), 10);
 	
 	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
 	gtk_widget_show (okbutton1);
 	gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
-	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+	gtk_widget_set_can_default (okbutton1, TRUE);
 
 	return GTK_DIALOG(dialog1);
 
@@ -185,7 +185,7 @@ cong_error_dialog_new_with_convenience(GtkWindow *parent_window,
 
        	dialog_action_area = GTK_DIALOG (dialog)->action_area;
 	gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area), 6);
-	gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area), 12);
+	gtk_box_set_spacing (GTK_BOX (dialog_action_area), 12);
         
 	if (is_convenience_default)
 	  {
diff --git a/src/cong-file-export.c b/src/cong-file-export.c
index fa1d199..b817fbf 100644
--- a/src/cong-file-export.c
+++ b/src/cong-file-export.c
@@ -303,7 +303,7 @@ static GtkWidget *cong_document_export_dialog_new(CongDocument *doc,
 	/* Set up filename entry widgetry: */
 	{
 		dialog_details->filename_entry = GTK_ENTRY(gtk_entry_new());
-		gtk_entry_set_editable(dialog_details->filename_entry, FALSE);		
+		gtk_editable_set_editable(GTK_EDITABLE(dialog_details->filename_entry), FALSE);
 
 		select_filename_button = gtk_button_new_from_stock(GTK_STOCK_SAVE_AS);
 
diff --git a/src/cong-primary-window.c b/src/cong-primary-window.c
index f3d3f30..8ad7725 100644
--- a/src/cong-primary-window.c
+++ b/src/cong-primary-window.c
@@ -231,7 +231,7 @@ CongApp the_app;
  * TODO: Write me
  * Returns:
  */
-GtkPixmap* 
+GtkImage*
 cong_primary_window_create_pixmap(CongPrimaryWindow *primary_window, char** xpm)
 {
 	GdkPixmap *p;
@@ -245,7 +245,7 @@ cong_primary_window_create_pixmap(CongPrimaryWindow *primary_window, char** xpm)
 	p = gdk_pixmap_create_from_xpm_d(primary_window->window->window, &mask,
 					 &style->bg[GTK_STATE_NORMAL],
 					 (gchar **) xpm);
-	return GTK_PIXMAP(gtk_pixmap_new(p, mask));
+	return GTK_IMAGE(gtk_image_new_from_pixmap(p, mask));
 }
 
 /**
@@ -593,8 +593,6 @@ void
 cong_primary_window_make_gui(CongPrimaryWindow *primary_window)
 {
 	g_assert(primary_window);
-
-	gdk_rgb_init();
 	
 	/* --- Main window --- */
 	primary_window->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -603,11 +601,11 @@ cong_primary_window_make_gui(CongPrimaryWindow *primary_window)
 
 	gtk_window_set_default_icon_name("conglomerate");
 
-	gtk_signal_connect(GTK_OBJECT(primary_window->window), "delete_event",
-			   GTK_SIGNAL_FUNC(delete_event), primary_window);
+	g_signal_connect(primary_window->window, "delete_event",
+			 G_CALLBACK(delete_event), primary_window);
 
-	gtk_signal_connect(GTK_OBJECT(primary_window->window), "destroy",
-			   GTK_SIGNAL_FUNC(destroy), primary_window);
+	g_signal_connect(primary_window->window, "destroy",
+			 G_CALLBACK(destroy), primary_window);
 
 	gtk_container_set_border_width(GTK_CONTAINER(primary_window->window), 0);
 
diff --git a/src/cong-tree-view.c b/src/cong-tree-view.c
index 534be25..f1ade00 100644
--- a/src/cong-tree-view.c
+++ b/src/cong-tree-view.c
@@ -250,10 +250,10 @@ cong_tree_view_new (CongDocument *doc,
 		gtk_tree_view_append_column (GTK_TREE_VIEW (details->gtk_tree_view), column);
 		
 		/* Wire up the context-menu callback */
-		gtk_signal_connect_object(GTK_OBJECT(details->gtk_tree_view), 
-					  "event",
-					  (GtkSignalFunc) tree_popup_show, 
-					  details->gtk_tree_view);
+		g_signal_connect_swapped(details->gtk_tree_view,
+		                         "event",
+		                         G_CALLBACK(tree_popup_show),
+		                         details->gtk_tree_view);
 
 		/* Deal with selection changes: */
 		details->gtk_tree_view_selection_changed_handler = g_signal_connect (G_OBJECT(gtk_tree_view_get_selection (details->gtk_tree_view)), 
diff --git a/src/cong-util.c b/src/cong-util.c
index 7442135..afffd58 100644
--- a/src/cong-util.c
+++ b/src/cong-util.c
@@ -1365,10 +1365,7 @@ cong_util_make_menu_item (const gchar *label,
 	}
 
 	if (tip) {
-		gtk_tooltips_set_tip (cong_app_get_tooltips (cong_app_singleton()),
-				      GTK_WIDGET(item),
-				      tip,
-				      tip);
+		gtk_widget_set_tooltip_text (GTK_WIDGET(item), tip);
 	}
 
 	return GTK_MENU_ITEM(item);
diff --git a/src/cursor.c b/src/cursor.c
index 69db94f..520c20f 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -33,7 +33,7 @@ cong_cursor_init(CongCursor *curs, CongDocument *doc)
 
 	cong_location_nullify(&curs->location);
 
-	curs->timeout_id = gtk_timeout_add(500, cong_cursor_blink, curs);
+	curs->timeout_id = g_timeout_add(500, cong_cursor_blink, curs);
 	curs->gc = gdk_gc_new(cong_gui_get_a_window()->window);
 	gdk_gc_copy(curs->gc, cong_gui_get_a_window()->style->black_gc);
 	/* we really want a black cursor for visibility */	
@@ -58,7 +58,7 @@ cong_cursor_uninit(CongCursor *curs)
 	cong_location_nullify(&curs->location);
 
 	if (curs->timeout_id) {
-		gtk_timeout_remove (curs->timeout_id);
+		g_source_remove (curs->timeout_id);
 		curs->timeout_id = 0;
 	}
 



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