[gnome-utils] [gsearchtool] Migrate to GTK3
- From: Dennis Cranston <dcransto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] [gsearchtool] Migrate to GTK3
- Date: Mon, 18 Oct 2010 00:28:06 +0000 (UTC)
commit 96b2107a2907358b01759dc08332b5b64d8847eb
Author: Dennis Cranston <dennis_cranston yahoo com>
Date: Sun Oct 17 10:26:59 2010 -0700
[gsearchtool] Migrate to GTK3
configure.ac | 2 +-
gsearchtool/ChangeLog | 6 ++
gsearchtool/Makefile.am | 4 +-
gsearchtool/gsearchtool-callbacks.c | 62 +++-----------------
gsearchtool/gsearchtool.c | 24 +-------
gsearchtool/libgnomeui-deprecated/Makefile.am | 4 +-
.../libgnomeui-deprecated/gsearchtool-entry.c | 15 +++--
.../libgnomeui-deprecated/gsearchtool-entry.h | 4 +-
8 files changed, 33 insertions(+), 88 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 68b5e5f..a94e2d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,7 +102,7 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
-PKG_CHECK_MODULES(LIBEGGSMCLIENT, gtk+-2.0 >= $GTK2_REQUIRED)
+PKG_CHECK_MODULES(LIBEGGSMCLIENT, gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(LIBEGGSMCLIENT_CFLAGS)
AC_SUBST(LIBEGGSMCLIENT_LIBS)
diff --git a/gsearchtool/ChangeLog b/gsearchtool/ChangeLog
index 7575e45..014fc71 100644
--- a/gsearchtool/ChangeLog
+++ b/gsearchtool/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-17 Dennis Cranston <dennis_cranston yahoo com>
+
+ * gsearchtool.c, gsearchtool-callbacks.c,
+ libgnomeui-deprecated/gsearchtool-entry.[ch]:
+ Migrate code to GTK3.
+
2010-10-05 Dennis Cranston <dennis_cranston yahoo com>
* gsearchtool.c (gsearch_setup_goption_descriptions):
diff --git a/gsearchtool/Makefile.am b/gsearchtool/Makefile.am
index 3a301df..77763c2 100644
--- a/gsearchtool/Makefile.am
+++ b/gsearchtool/Makefile.am
@@ -33,12 +33,12 @@ gnome_search_tool_CFLAGS = \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
- $(GTK2_CFLAGS) \
+ $(GTK_CFLAGS) \
$(GCONF_CFLAGS)
gnome_search_tool_LDADD = \
$(GNOME_UTILS_LIBS) \
- $(GTK2_LIBS) \
+ $(GTK_LIBS) \
$(GIO_UNIX_LIBS) \
$(libgnomeui_deprecated_LIB) \
$(libeggsmclient_LIB)
diff --git a/gsearchtool/gsearchtool-callbacks.c b/gsearchtool/gsearchtool-callbacks.c
index 2ad1b7e..d3b7b16 100644
--- a/gsearchtool/gsearchtool-callbacks.c
+++ b/gsearchtool/gsearchtool-callbacks.c
@@ -195,10 +195,6 @@ click_help_cb (GtkWidget * widget,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
error->message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -270,7 +266,7 @@ remove_constraint_cb (GtkWidget * widget,
&gsearch->window_geometry,
GDK_HINT_MIN_SIZE);
- gtk_container_remove (GTK_CONTAINER (gsearch->available_options_vbox), widget->parent);
+ gtk_container_remove (GTK_CONTAINER (gsearch->available_options_vbox), gtk_widget_get_parent (widget));
gsearch->available_options_selected_list =
g_list_remove (gsearch->available_options_selected_list, constraint);
@@ -360,10 +356,6 @@ display_dialog_file_open_limit (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
secondary, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
button = gtk_button_new_from_stock ("gtk-open");
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -397,10 +389,6 @@ display_dialog_could_not_open_file (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -426,10 +414,6 @@ display_dialog_could_not_open_folder (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("The nautilus file manager is not running."));
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -493,7 +477,7 @@ open_file_cb (GtkMenuItem * action,
if (!no_files_found) {
GAppInfo * app = NULL;
- if (GTK_IS_OBJECT (action)) {
+ if (GTK_IS_MENU_ITEM (action)) {
app = g_object_get_data (G_OBJECT (action), "app");
}
@@ -557,10 +541,6 @@ display_dialog_folder_open_limit (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
secondary, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
button = gtk_button_new_from_stock ("gtk-open");
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -702,10 +682,6 @@ display_dialog_could_not_move_to_trash (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -737,10 +713,6 @@ display_dialog_delete_permanently (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
secondary, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
button = gtk_button_new_from_stock ("gtk-delete");
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -775,10 +747,6 @@ display_dialog_could_not_delete (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -958,15 +926,15 @@ file_key_press_event_cb (GtkWidget * widget,
GdkEventKey * event,
gpointer data)
{
- if (event->keyval == GDK_space ||
- event->keyval == GDK_Return ||
- event->keyval == GDK_KP_Enter) {
+ if (event->keyval == GDK_KEY_space ||
+ event->keyval == GDK_KEY_Return ||
+ event->keyval == GDK_KEY_KP_Enter) {
if (event->state != GDK_CONTROL_MASK) {
open_file_cb ((GtkMenuItem *) NULL, data);
return TRUE;
}
}
- else if (event->keyval == GDK_Delete) {
+ else if (event->keyval == GDK_KEY_Delete) {
move_to_trash_cb ((GtkAction *) NULL, data);
return TRUE;
}
@@ -1581,7 +1549,7 @@ drag_file_cb (GtkWidget * widget,
uri_list = g_strconcat (uri_list, "\n", tmp_uri, NULL);
}
gtk_selection_data_set (selection_data,
- selection_data->target,
+ gtk_selection_data_get_target (selection_data),
8,
(guchar *) uri_list,
strlen (uri_list));
@@ -1648,10 +1616,6 @@ display_dialog_could_not_save_no_name (GtkWidget * window)
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
secondary, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -1680,10 +1644,6 @@ display_dialog_could_not_save_to (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -1717,10 +1677,6 @@ display_dialog_could_not_save_exists (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
secondary);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
button = gsearchtool_button_new_with_stock_icon (_("_Replace"), GTK_STOCK_OK);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_show (button);
@@ -1836,7 +1792,7 @@ key_press_cb (GtkWidget * widget,
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- if (event->keyval == GDK_Escape) {
+ if (event->keyval == GDK_KEY_Escape) {
if (gsearch->command_details->command_status == RUNNING) {
click_stop_cb (widget, data);
}
@@ -1844,7 +1800,7 @@ key_press_cb (GtkWidget * widget,
quit_cb (widget, (GdkEvent *) NULL, data);
}
}
- else if (event->keyval == GDK_F10) {
+ else if (event->keyval == GDK_KEY_F10) {
if (event->state & GDK_SHIFT_MASK) {
gboolean no_files_found = FALSE;
GtkTreeModel * model;
diff --git a/gsearchtool/gsearchtool.c b/gsearchtool/gsearchtool.c
index 1764172..c81ff0a 100644
--- a/gsearchtool/gsearchtool.c
+++ b/gsearchtool/gsearchtool.c
@@ -489,10 +489,6 @@ display_dialog_character_set_conversion_error (GtkWidget * window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
(error == NULL) ? " " : error->message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -1717,9 +1713,6 @@ handle_search_command_stderr_io (GIOChannel * ioc,
" There were errors while performing this search."));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), " ");
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-
hbox = gtk_hbox_new (0, FALSE);
spacer = gtk_label_new (" ");
@@ -1733,7 +1726,7 @@ handle_search_command_stderr_io (GIOChannel * ioc,
label = gtk_label_new (error_msgs->str);
gtk_container_add (GTK_CONTAINER (expander), label);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
g_signal_connect (G_OBJECT (dialog),
@@ -1761,9 +1754,6 @@ handle_search_command_stderr_io (GIOChannel * ioc,
"Please reference the help documentation for instructions "
"on how to configure and enable quick searches.");
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-
hbox = gtk_hbox_new (0, FALSE);
spacer = gtk_label_new (" ");
@@ -1777,11 +1767,11 @@ handle_search_command_stderr_io (GIOChannel * ioc,
label = gtk_label_new (error_msgs->str);
gtk_container_add (GTK_CONTAINER (expander), label);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
button = gsearchtool_button_new_with_stock_icon (_("Disable _Quick Search"), GTK_STOCK_OK);
- gtk_widget_set_can_default (button, TRUE);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
@@ -1836,10 +1826,6 @@ spawn_search_command (GSearchWindow * gsearch,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
(error == NULL) ? " " : error->message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_error_free (error);
@@ -1869,10 +1855,6 @@ spawn_search_command (GSearchWindow * gsearch,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
(error == NULL) ? " " : error->message, NULL);
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
-
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_error_free (error);
diff --git a/gsearchtool/libgnomeui-deprecated/Makefile.am b/gsearchtool/libgnomeui-deprecated/Makefile.am
index 7c3c9b7..54d67bd 100644
--- a/gsearchtool/libgnomeui-deprecated/Makefile.am
+++ b/gsearchtool/libgnomeui-deprecated/Makefile.am
@@ -7,13 +7,13 @@ noinst_LTLIBRARIES = libgnomeui-deprecated.la
libgnomeui_deprecated_la_CFLAGS = \
$(GLIB_CFLAGS) \
- $(GTK2_CFLAGS) \
+ $(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(WARN_CFLAGS)
libgnomeui_deprecated_la_LIBADD = \
$(GLIB_LIBS) \
- $(GTK2_LIBS) \
+ $(GTK_LIBS) \
$(GCONF_LIBS)
libgnomeui_deprecated_la_SOURCES = \
diff --git a/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.c b/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.c
index 31e86a2..df4bcb3 100644
--- a/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.c
+++ b/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.c
@@ -60,7 +60,7 @@ struct _GsearchHistoryEntryPrivate
GConfClient *gconf_client;
};
-G_DEFINE_TYPE (GsearchHistoryEntry, gsearch_history_entry, GTK_TYPE_COMBO_BOX_ENTRY)
+G_DEFINE_TYPE (GsearchHistoryEntry, gsearch_history_entry, GTK_TYPE_COMBO_BOX)
static void
gsearch_history_entry_set_property (GObject *object,
@@ -112,12 +112,12 @@ gsearch_history_entry_get_property (GObject *object,
}
static void
-gsearch_history_entry_destroy (GtkObject *object)
+gsearch_history_entry_destroy (GtkWidget *object)
{
gsearch_history_entry_set_enable_completion (GSEARCH_HISTORY_ENTRY (object),
FALSE);
- GTK_OBJECT_CLASS (gsearch_history_entry_parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (gsearch_history_entry_parent_class)->destroy_event (object, NULL);
}
static void
@@ -142,12 +142,12 @@ static void
gsearch_history_entry_class_init (GsearchHistoryEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
object_class->set_property = gsearch_history_entry_set_property;
object_class->get_property = gsearch_history_entry_get_property;
object_class->finalize = gsearch_history_entry_finalize;
- gtkobject_class->destroy = gsearch_history_entry_destroy;
+ gtkwidget_class->destroy = gsearch_history_entry_destroy;
g_object_class_install_property (object_class,
PROP_HISTORY_ID,
@@ -494,7 +494,7 @@ gsearch_history_entry_set_enable_completion (GsearchHistoryEntry *entry,
gtk_entry_completion_set_inline_completion (entry->priv->completion, TRUE);
/* Assign the completion to the entry */
- gtk_entry_set_completion (GTK_ENTRY (gsearch_history_entry_get_entry(entry)),
+ gtk_entry_set_completion (GTK_ENTRY (gsearch_history_entry_get_entry (entry)),
entry->priv->completion);
}
else
@@ -537,9 +537,10 @@ gsearch_history_entry_new (const gchar *history_id,
store = gtk_list_store_new (1, G_TYPE_STRING);
ret = g_object_new (GSEARCH_TYPE_HISTORY_ENTRY,
+ "has-entry", TRUE,
"history-id", history_id,
"model", store,
- "text-column", 0,
+ "entry-text-column", 0,
NULL);
g_object_unref (store);
diff --git a/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.h b/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.h
index 1bc044e..3d0101b 100644
--- a/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.h
+++ b/gsearchtool/libgnomeui-deprecated/gsearchtool-entry.h
@@ -47,12 +47,12 @@ typedef struct _GsearchHistoryEntryPrivate GsearchHistoryEntryPrivate;
struct _GsearchHistoryEntryClass
{
- GtkComboBoxEntryClass parent_class;
+ GtkComboBoxClass parent_class;
};
struct _GsearchHistoryEntry
{
- GtkComboBoxEntry parent_instance;
+ GtkComboBox parent_instance;
GsearchHistoryEntryPrivate *priv;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]