diff options
author | TingPing <tingping@tingping.se> | 2013-05-12 01:43:27 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-09-20 17:24:39 -0400 |
commit | ae04663aa91f864250fd109fe6433c8dea7c4a93 (patch) | |
tree | d02b14b3ef494c0f82fcf17ce8c8b4fffe9bcf3c /src/fe-gtk | |
parent | 9f8073ab7705e0b5d9b83cb046741bd5c5f78f05 (diff) |
First round of using GTK accessor functions
This is the first step to build with GSEAL_ENABLE setup.c uses a deprecated fontchooser, chanview-tabs.c didn't like the conversion, and I am waiting to do some work on xtext.c before converting it.
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/banlist.c | 2 | ||||
-rw-r--r-- | src/fe-gtk/chanlist.c | 16 | ||||
-rw-r--r-- | src/fe-gtk/chanview-tree.c | 2 | ||||
-rw-r--r-- | src/fe-gtk/dccgui.c | 2 | ||||
-rw-r--r-- | src/fe-gtk/fe-gtk.c | 6 | ||||
-rw-r--r-- | src/fe-gtk/fe-gtk.h | 2 | ||||
-rw-r--r-- | src/fe-gtk/fkeys.c | 14 | ||||
-rw-r--r-- | src/fe-gtk/gtkutil.c | 19 | ||||
-rw-r--r-- | src/fe-gtk/joind.c | 20 | ||||
-rw-r--r-- | src/fe-gtk/maingui.c | 125 | ||||
-rw-r--r-- | src/fe-gtk/menu.c | 50 | ||||
-rw-r--r-- | src/fe-gtk/notifygui.c | 6 | ||||
-rw-r--r-- | src/fe-gtk/plugin-tray.c | 2 | ||||
-rw-r--r-- | src/fe-gtk/servlistgui.c | 55 | ||||
-rw-r--r-- | src/fe-gtk/setup.c | 28 | ||||
-rw-r--r-- | src/fe-gtk/sexy-spell-entry.c | 6 | ||||
-rw-r--r-- | src/fe-gtk/userlistgui.c | 4 |
17 files changed, 175 insertions, 184 deletions
diff --git a/src/fe-gtk/banlist.c b/src/fe-gtk/banlist.c index d80d9333..27aee073 100644 --- a/src/fe-gtk/banlist.c +++ b/src/fe-gtk/banlist.c @@ -632,7 +632,7 @@ banlist_toggle (GtkWidget *item, gpointer data) if (bit) /* Should be gassert() */ { banl->checked &= ~bit; - banl->checked |= (GTK_TOGGLE_BUTTON (item)->active)? bit: 0; + banl->checked |= (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item)))? bit: 0; banlist_do_refresh (banl); } } diff --git a/src/fe-gtk/chanlist.c b/src/fe-gtk/chanlist.c index d0e0ea40..11a20061 100644 --- a/src/fe-gtk/chanlist.c +++ b/src/fe-gtk/chanlist.c @@ -75,7 +75,7 @@ chanlist_match (server *serv, const char *str) switch (serv->gui->chanlist_search_type) { case 1: - return match (GTK_ENTRY (serv->gui->chanlist_wild)->text, str); + return match (gtk_entry_get_text (GTK_ENTRY (serv->gui->chanlist_wild)), str); #ifndef WIN32 case 2: if (!serv->gui->have_regex) @@ -84,7 +84,7 @@ chanlist_match (server *serv, const char *str) return !regexec (&serv->gui->chanlist_match_regex, str, 1, NULL, REG_NOTBOL); #endif default: /* case 0: */ - return nocasestrstr (str, GTK_ENTRY (serv->gui->chanlist_wild)->text) ? 1 : 0; + return nocasestrstr (str, gtk_entry_get_text (GTK_ENTRY (serv->gui->chanlist_wild))) ? 1 : 0; } } @@ -227,7 +227,7 @@ chanlist_place_row_in_gui (server *serv, chanlistrow *next_row, gboolean force) return; } - if (GTK_ENTRY (serv->gui->chanlist_wild)->text[0]) + if (gtk_entry_get_text (GTK_ENTRY (serv->gui->chanlist_wild))[0]) { /* Check what the user wants to match. If both buttons or _neither_ * button is checked, look for match in both by default. @@ -414,7 +414,7 @@ chanlist_find_cb (GtkWidget * wid, server *serv) regfree (&serv->gui->chanlist_match_regex); } - if (regcomp (&serv->gui->chanlist_match_regex, GTK_ENTRY (wid)->text, + if (regcomp (&serv->gui->chanlist_match_regex, gtk_entry_get_text (GTK_ENTRY (wid)), REG_ICASE | REG_EXTENDED | REG_NOSUB) == 0) serv->gui->have_regex = 1; #endif @@ -423,13 +423,13 @@ chanlist_find_cb (GtkWidget * wid, server *serv) static void chanlist_match_channel_button_toggled (GtkWidget * wid, server *serv) { - serv->gui->chanlist_match_wants_channel = GTK_TOGGLE_BUTTON (wid)->active; + serv->gui->chanlist_match_wants_channel = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)); } static void chanlist_match_topic_button_toggled (GtkWidget * wid, server *serv) { - serv->gui->chanlist_match_wants_topic = GTK_TOGGLE_BUTTON (wid)->active; + serv->gui->chanlist_match_wants_topic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)); } static char * @@ -519,7 +519,7 @@ chanlist_save (GtkWidget * wid, server *serv) static gboolean chanlist_flash (server *serv) { - if (serv->gui->chanlist_refresh->state != GTK_STATE_ACTIVE) + if (gtk_widget_get_state (serv->gui->chanlist_refresh) != GTK_STATE_ACTIVE) gtk_widget_set_state (serv->gui->chanlist_refresh, GTK_STATE_ACTIVE); else gtk_widget_set_state (serv->gui->chanlist_refresh, GTK_STATE_PRELIGHT); @@ -762,7 +762,7 @@ chanlist_opengui (server *serv, int do_refresh) store = (GtkListStore *) custom_list_new(); view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->parent), + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (gtk_widget_get_parent (view)), GTK_SHADOW_IN); serv->gui->chanlist_list = view; diff --git a/src/fe-gtk/chanview-tree.c b/src/fe-gtk/chanview-tree.c index a7cd7235..5eb19ad2 100644 --- a/src/fe-gtk/chanview-tree.c +++ b/src/fe-gtk/chanview-tree.c @@ -118,7 +118,7 @@ cv_tree_init (chanview *cv) if (cv->style) gtk_widget_set_style (view, cv->style); /*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/ - GTK_WIDGET_UNSET_FLAGS (view, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (view, FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE); if (prefs.hex_gui_tab_dots) diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c index a3c2619a..76b1e2fb 100644 --- a/src/fe-gtk/dccgui.c +++ b/src/fe-gtk/dccgui.c @@ -769,7 +769,7 @@ dcc_exp_cb (GtkWidget *exp, GtkWidget *box) static void dcc_toggle (GtkWidget *item, gpointer data) { - if (GTK_TOGGLE_BUTTON (item)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item))) { view_mode = GPOINTER_TO_INT (data); dcc_fill_window (GPOINTER_TO_INT (data)); diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 3469569e..5f811339 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -796,7 +796,7 @@ fe_set_lag (server *serv, int lag) if (sess->gui->lagometer) { gtk_progress_bar_set_fraction ((GtkProgressBar *) sess->gui->lagometer, per); - add_tip (sess->gui->lagometer->parent, lagtip); + add_tip (gtk_widget_get_parent (sess->gui->lagometer), lagtip); } if (sess->gui->laginfo) gtk_label_set_text ((GtkLabel *) sess->gui->laginfo, lagtext); @@ -842,7 +842,7 @@ fe_set_throttle (server *serv) if (sess->gui->throttlemeter) { gtk_progress_bar_set_fraction ((GtkProgressBar *) sess->gui->throttlemeter, per); - add_tip (sess->gui->throttlemeter->parent, tip); + add_tip (gtk_widget_get_parent (sess->gui->throttlemeter), tip); } if (sess->gui->throttleinfo) gtk_label_set_text ((GtkLabel *) sess->gui->throttleinfo, tbuf); @@ -948,7 +948,7 @@ fe_gui_info_ptr (session *sess, int info_type) { case 0: /* native window pointer (for plugins) */ #ifdef WIN32 - return gdk_win32_window_get_impl_hwnd (sess->gui->window->window); + return gdk_win32_window_get_impl_hwnd (gtk_widget_get_window (sess->gui->window)); #else return sess->gui->window; #endif diff --git a/src/fe-gtk/fe-gtk.h b/src/fe-gtk/fe-gtk.h index 80788761..d686a73e 100644 --- a/src/fe-gtk/fe-gtk.h +++ b/src/fe-gtk/fe-gtk.h @@ -206,7 +206,7 @@ int SPELL_ENTRY_GET_POS (GtkWidget *entry); void SPELL_ENTRY_SET_POS (GtkWidget *entry, int pos); void SPELL_ENTRY_INSERT (GtkWidget *entry, const char *text, int len, int *pos); #else -#define SPELL_ENTRY_GET_TEXT(e) (GTK_ENTRY(e)->text) +#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e)))) #define SPELL_ENTRY_SET_TEXT(e,txt) gtk_entry_set_text(GTK_ENTRY(e),txt) #define SPELL_ENTRY_SET_EDITABLE(e,v) gtk_editable_set_editable(GTK_EDITABLE(e),v) #define SPELL_ENTRY_GET_POS(e) gtk_editable_get_position(GTK_EDITABLE(e)) diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index 4be2082e..146804d0 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -569,7 +569,7 @@ key_dialog_sel_row (GtkWidget * clist, gint row, gint column, static void key_dialog_tog_key (GtkWidget * tog, int kstate) { - int state = GTK_TOGGLE_BUTTON (tog)->active; + int state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tog)); int row = gtkutil_clist_selection (key_dialog_kb_clist); struct key_binding *kb; char buf[32]; @@ -1303,8 +1303,8 @@ key_action_scroll_page (GtkWidget * wid, GdkEventKey * evt, char *d1, if (!sess) return 0; - adj = GTK_RANGE (sess->gui->vscrollbar)->adjustment; - end = adj->upper - adj->lower - adj->page_size; + adj = gtk_range_get_adjustment (GTK_RANGE (sess->gui->vscrollbar)); + end = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower (adj) - gtk_adjustment_get_page_size (adj); switch (type) { @@ -1317,19 +1317,19 @@ key_action_scroll_page (GtkWidget * wid, GdkEventKey * evt, char *d1, break; case PAGE_UP: - value = adj->value - (adj->page_size - 1); + value = gtk_adjustment_get_value (adj) - (gtk_adjustment_get_page_size (adj) - 1); break; case PAGE_DOWN: - value = adj->value + (adj->page_size - 1); + value = gtk_adjustment_get_value (adj) + (gtk_adjustment_get_page_size (adj) - 1); break; case LINE_UP: - value = adj->value - 1.0; + value = gtk_adjustment_get_value (adj) - 1.0; break; case LINE_DOWN: - value = adj->value + 1.0; + value = gtk_adjustment_get_value (adj) + 1.0; break; } diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c index f6b9ad53..6da759c4 100644 --- a/src/fe-gtk/gtkutil.c +++ b/src/fe-gtk/gtkutil.c @@ -325,8 +325,9 @@ fe_get_str (char *msg, char *def, void *callback, void *userdata) GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window)); + gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE); if (userdata == (void *)1) /* nick box is usually on the very bottom, make it centered */ { @@ -354,7 +355,7 @@ fe_get_str (char *msg, char *def, void *callback, void *userdata) g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtkutil_get_str_response), entry); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox); gtk_widget_show_all (dialog); } @@ -397,7 +398,7 @@ fe_get_int (char *msg, int def, void *callback, void *userdata) GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE); + gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window)); @@ -408,9 +409,9 @@ fe_get_int (char *msg, int def, void *callback, void *userdata) spin = gtk_spin_button_new (NULL, 1, 0); adj = gtk_spin_button_get_adjustment ((GtkSpinButton*)spin); - adj->lower = 0; - adj->upper = 1024; - adj->step_increment = 1; + gtk_adjustment_set_lower (adj, 0); + gtk_adjustment_set_upper (adj, 1024); + gtk_adjustment_set_step_increment (adj, 1); gtk_adjustment_changed (adj); gtk_spin_button_set_value ((GtkSpinButton*)spin, def); gtk_box_pack_end (GTK_BOX (hbox), spin, 0, 0, 0); @@ -421,7 +422,7 @@ fe_get_int (char *msg, int def, void *callback, void *userdata) g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtkutil_get_number_response), spin); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox); gtk_widget_show_all (dialog); } @@ -570,7 +571,7 @@ add_tip (GtkWidget * wid, char *text) void show_and_unfocus (GtkWidget * wid) { - GTK_WIDGET_UNSET_FLAGS (wid, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (wid, FALSE); gtk_widget_show (wid); } @@ -621,7 +622,7 @@ gtkutil_copy_to_clipboard (GtkWidget *widget, GdkAtom selection, GtkClipboard *clip, *clip2; win = gtk_widget_get_toplevel (GTK_WIDGET (widget)); - if (GTK_WIDGET_TOPLEVEL (win)) + if (gtk_widget_is_toplevel (win)) { int len = strlen (str); diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c index 55d62e3b..7cdb7a14 100644 --- a/src/fe-gtk/joind.c +++ b/src/fe-gtk/joind.c @@ -43,7 +43,7 @@ static void joind_radio2_cb (GtkWidget *radio, server *serv) { - if (GTK_TOGGLE_BUTTON (radio)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) { gtk_widget_grab_focus (serv->gui->joind_entry); gtk_editable_set_position (GTK_EDITABLE (serv->gui->joind_entry), 999); @@ -79,13 +79,13 @@ joind_ok_cb (GtkWidget *ok, server *serv) } /* do nothing */ - if (GTK_TOGGLE_BUTTON (serv->gui->joind_radio1)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio1))) goto xit; /* join specific channel */ - if (GTK_TOGGLE_BUTTON (serv->gui->joind_radio2)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio2))) { - char *text = GTK_ENTRY (serv->gui->joind_entry)->text; + char *text = (char *)gtk_entry_get_text (GTK_ENTRY (serv->gui->joind_entry)); if (strlen (text) < 2) { fe_message (_("Channel name too short, try again."), FE_MSG_ERROR); @@ -100,7 +100,7 @@ joind_ok_cb (GtkWidget *ok, server *serv) xit: prefs.hex_gui_join_dialog = 0; - if (GTK_TOGGLE_BUTTON (serv->gui->joind_check)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_check))) prefs.hex_gui_join_dialog = 1; gtk_widget_destroy (serv->gui->joind_win); @@ -134,7 +134,7 @@ joind_show_dialog (server *serv) gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_position (GTK_WINDOW (dialog1), GTK_WIN_POS_MOUSE); - dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog1)); gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); @@ -167,7 +167,7 @@ joind_show_dialog (server *serv) label = gtk_label_new (_("In the Server-List window, no channel (chat room) has been entered to be automatically joined for this network.")); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); - GTK_LABEL (label)->wrap = TRUE; + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); label = gtk_label_new (_("What would you like to do next?")); @@ -223,14 +223,14 @@ joind_show_dialog (server *serv) gtk_widget_show (checkbutton1); gtk_box_pack_start (GTK_BOX (vbox1), checkbutton1, FALSE, FALSE, 0); - dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog1)); gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); - gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog1)->action_area), okbutton1, FALSE, TRUE, 0); - GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); + gtk_box_pack_end (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog1))), okbutton1, FALSE, TRUE, 0); + gtk_widget_set_can_default (okbutton1, TRUE); g_signal_connect (G_OBJECT (dialog1), "destroy", G_CALLBACK (joind_destroy_cb), serv); diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index b643485a..b9d402dc 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -298,7 +298,7 @@ fe_set_tab_color (struct session *sess, int col) static void mg_set_myself_away (session_gui *gui, gboolean away) { - gtk_label_set_attributes (GTK_LABEL (GTK_BIN (gui->nick_label)->child), + gtk_label_set_attributes (GTK_LABEL (gtk_bin_get_child (GTK_BIN (gui->nick_label))), away ? away_list : NULL); } @@ -545,11 +545,7 @@ mg_show_generic_tab (GtkWidget *box) int num; GtkWidget *f = NULL; -#if defined(GTK_WIDGET_HAS_FOCUS) - if (current_sess && GTK_WIDGET_HAS_FOCUS (current_sess->gui->input_box)) -#else if (current_sess && gtk_widget_has_focus (current_sess->gui->input_box)) -#endif f = current_sess->gui->input_box; num = gtk_notebook_page_num (GTK_NOTEBOOK (mg_gui->note_book), box); @@ -658,16 +654,16 @@ mg_unpopulate (session *sess) res = sess->res; res->input_text = strdup (SPELL_ENTRY_GET_TEXT (gui->input_box)); - res->topic_text = strdup (GTK_ENTRY (gui->topic_entry)->text); - res->limit_text = strdup (GTK_ENTRY (gui->limit_entry)->text); - res->key_text = strdup (GTK_ENTRY (gui->key_entry)->text); + res->topic_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->topic_entry))); + res->limit_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->limit_entry))); + res->key_text = strdup (gtk_entry_get_text (GTK_ENTRY (gui->key_entry))); if (gui->laginfo) res->lag_text = strdup (gtk_label_get_text (GTK_LABEL (gui->laginfo))); if (gui->throttleinfo) res->queue_text = strdup (gtk_label_get_text (GTK_LABEL (gui->throttleinfo))); for (i = 0; i < NUM_FLAG_WIDS - 1; i++) - res->flag_wid_state[i] = GTK_TOGGLE_BUTTON (gui->flag_wid[i])->active; + res->flag_wid_state[i] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gui->flag_wid[i])); res->old_ul_value = userlist_get_value (gui->user_tree); if (gui->lagometer) @@ -749,9 +745,9 @@ mg_set_topic_tip (session *sess) add_tip (sess->gui->topic_entry, _("No topic is set")); break; default: - if (GTK_ENTRY (sess->gui->topic_entry)->text && - GTK_ENTRY (sess->gui->topic_entry)->text[0]) - add_tip (sess->gui->topic_entry, GTK_ENTRY (sess->gui->topic_entry)->text); + if (gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry)) && + gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry))[0]) + add_tip (sess->gui->topic_entry, (char *)gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry))); else add_tip (sess->gui->topic_entry, NULL); } @@ -760,13 +756,8 @@ mg_set_topic_tip (session *sess) static void mg_hide_empty_pane (GtkPaned *pane) { -#if defined(GTK_WIDGET_VISIBLE) - if ((pane->child1 == NULL || !GTK_WIDGET_VISIBLE (pane->child1)) && - (pane->child2 == NULL || !GTK_WIDGET_VISIBLE (pane->child2))) -#else - if ((pane->child1 == NULL || !gtk_widget_get_visible (pane->child1)) && - (pane->child2 == NULL || !gtk_widget_get_visible (pane->child2))) -#endif + if ((gtk_paned_get_child1 (pane) == NULL || !gtk_widget_get_visible (gtk_paned_get_child1 (pane))) && + (gtk_paned_get_child2 (pane) == NULL || !gtk_widget_get_visible (gtk_paned_get_child2 (pane)))) { gtk_widget_hide (GTK_WIDGET (pane)); return; @@ -789,6 +780,7 @@ mg_userlist_showhide (session *sess, int show) session_gui *gui = sess->gui; int handle_size; int right_size; + GtkAllocation allocation; right_size = MAX (prefs.hex_gui_pane_right_size, prefs.hex_gui_pane_right_size_min); @@ -797,8 +789,9 @@ mg_userlist_showhide (session *sess, int show) gtk_widget_show (gui->user_box); gui->ul_hidden = 0; + gtk_widget_get_allocation (gui->hpane_right, &allocation); gtk_widget_style_get (GTK_WIDGET (gui->hpane_right), "handle-size", &handle_size, NULL); - gtk_paned_set_position (GTK_PANED (gui->hpane_right), GTK_WIDGET (gui->hpane_right)->allocation.width - (right_size + handle_size)); + gtk_paned_set_position (GTK_PANED (gui->hpane_right), allocation.width - (right_size + handle_size)); } else { @@ -895,6 +888,7 @@ mg_populate (session *sess) restore_gui *res = sess->res; int i, render = TRUE; guint16 vis = gui->ul_hidden; + GtkAllocation allocation; switch (sess->type) { @@ -935,7 +929,8 @@ mg_populate (session *sess) /* xtext size change? Then don't render, wait for the expose caused by showing/hidding the userlist */ - if (vis != gui->ul_hidden && gui->user_box->allocation.width > 1) + gtk_widget_get_allocation (gui->user_box, &allocation); + if (vis != gui->ul_hidden && allocation.width > 1) render = FALSE; gtk_xtext_buffer_show (GTK_XTEXT (gui->xtext), res->buffer, render); @@ -982,14 +977,14 @@ mg_populate (session *sess) gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (gui->lagometer), res->lag_value); if (res->lag_tip) - add_tip (sess->gui->lagometer->parent, res->lag_tip); + add_tip (gtk_widget_get_parent (sess->gui->lagometer), res->lag_tip); } if (gui->throttlemeter) { gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (gui->throttlemeter), res->queue_value); if (res->queue_tip) - add_tip (sess->gui->throttlemeter->parent, res->queue_tip); + add_tip (gtk_widget_get_parent (sess->gui->throttlemeter), res->queue_tip); } /* did this tab have a connecting graph? restore it.. */ @@ -1000,7 +995,7 @@ mg_populate (session *sess) } /* menu items */ - GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY])->active = sess->server->is_away; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gui->menu_item[MENU_ID_AWAY]), sess->server->is_away); gtk_widget_set_sensitive (gui->menu_item[MENU_ID_AWAY], sess->server->connected); gtk_widget_set_sensitive (gui->menu_item[MENU_ID_JOIN], sess->server->end_of_motd); gtk_widget_set_sensitive (gui->menu_item[MENU_ID_DISCONNECT], @@ -1241,7 +1236,7 @@ mg_open_quit_dialog (gboolean minimize_button) gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - dialog_vbox1 = GTK_DIALOG (dialog)->vbox; + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_widget_show (dialog_vbox1); table1 = gtk_table_new (2, 2, FALSE); @@ -1278,7 +1273,7 @@ mg_open_quit_dialog (gboolean minimize_button) gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - dialog_action_area1 = GTK_DIALOG (dialog)->action_area; + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); @@ -1305,12 +1300,12 @@ mg_open_quit_dialog (gboolean minimize_button) switch (gtk_dialog_run (GTK_DIALOG (dialog))) { case 0: - if (GTK_TOGGLE_BUTTON (checkbutton1)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton1))) prefs.hex_gui_quit_dialog = 0; hexchat_exit (); break; case 1: /* minimize to tray */ - if (GTK_TOGGLE_BUTTON (checkbutton1)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton1))) { prefs.hex_gui_tray_close = 1; /*prefs.hex_gui_quit_dialog = 0;*/ @@ -1474,7 +1469,7 @@ mg_markup_item (GtkWidget *menu, char *text, int arg) GtkWidget *item; item = gtk_menu_item_new_with_label (""); - gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), text); + gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), text); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (mg_color_insert), GINT_TO_POINTER (arg)); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -1540,7 +1535,7 @@ mg_set_guint8 (GtkCheckMenuItem *item, guint8 *setting) guint8 logging = sess->text_logging; *setting = SET_OFF; - if (item->active) + if (gtk_check_menu_item_get_active (item)) *setting = SET_ON; /* has the logging setting changed? */ @@ -1608,7 +1603,7 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch) g_free (name); item = gtk_menu_item_new_with_label (""); - gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), buf); + gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), buf); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -1713,7 +1708,7 @@ mg_dialog_dnd_drop (GtkWidget * widget, GdkDragContext * context, gint x, { if (current_sess->type == SESS_DIALOG) /* sess->channel is really the nickname of dialogs */ - mg_dnd_drop_file (current_sess, current_sess->channel, selection_data->data); + mg_dnd_drop_file (current_sess, current_sess->channel, (char *)gtk_selection_data_get_data (selection_data)); } /* add a tabbed channel */ @@ -1804,7 +1799,7 @@ mg_topic_cb (GtkWidget *entry, gpointer userdata) if (sess->channel[0] && sess->server->connected && sess->type == SESS_CHANNEL) { - text = GTK_ENTRY (entry)->text; + text = (char *)gtk_entry_get_text (GTK_ENTRY (entry)); if (text[0] == 0) text = NULL; sess->server->p_topic (sess->server, sess->channel, text); @@ -1946,7 +1941,7 @@ mg_change_flag (GtkWidget * wid, session *sess, char flag) mode[2] = '\0'; if (serv->connected && sess->channel[0]) { - if (GTK_TOGGLE_BUTTON (wid)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid))) mode[0] = '+'; else mode[0] = '-'; @@ -1964,7 +1959,7 @@ flagl_hit (GtkWidget * wid, struct session *sess) const char *limit_str; server *serv = sess->server; - if (GTK_TOGGLE_BUTTON (wid)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid))) { if (serv->connected && sess->channel[0]) { @@ -1995,7 +1990,7 @@ flagk_hit (GtkWidget * wid, struct session *sess) snprintf (modes, sizeof (modes), "-k %s", gtk_entry_get_text (GTK_ENTRY (sess->gui->key_entry))); - if (GTK_TOGGLE_BUTTON (wid)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid))) modes[0] = '+'; serv->p_mode (serv, sess->channel, modes); @@ -2154,7 +2149,7 @@ mg_dialog_button_cb (GtkWidget *wid, char *cmd) if (!current_sess) return; - topic = (char *)(GTK_ENTRY (current_sess->gui->topic_entry)->text); + topic = (char *)(gtk_entry_get_text (GTK_ENTRY (current_sess->gui->topic_entry))); topic = strrchr (topic, '@'); if (topic) host = topic + 1; @@ -2558,15 +2553,12 @@ static void mg_rightpane_cb (GtkPaned *pane, GParamSpec *param, session_gui *gui) { int handle_size; - -/* if (pane->child1 == NULL || (!GTK_WIDGET_VISIBLE (pane->child1))) - return; - if (pane->child2 == NULL || (!GTK_WIDGET_VISIBLE (pane->child2))) - return;*/ + GtkAllocation allocation; gtk_widget_style_get (GTK_WIDGET (pane), "handle-size", &handle_size, NULL); /* record the position from the RIGHT side */ - prefs.hex_gui_pane_right_size = GTK_WIDGET (pane)->allocation.width - gtk_paned_get_position (pane) - handle_size; + gtk_widget_get_allocation (GTK_WIDGET(pane), &allocation); + prefs.hex_gui_pane_right_size = allocation.width - gtk_paned_get_position (pane) - handle_size; } static gboolean @@ -2697,17 +2689,17 @@ mg_place_userlist_and_chanview_real (session_gui *gui, GtkWidget *userlist, GtkW int unref_chanview = FALSE; /* first, remove userlist/treeview from their containers */ - if (userlist && userlist->parent) + if (userlist && gtk_widget_get_parent (userlist)) { g_object_ref (userlist); - gtk_container_remove (GTK_CONTAINER (userlist->parent), userlist); + gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (userlist)), userlist); unref_userlist = TRUE; } - if (chanview && chanview->parent) + if (chanview && gtk_widget_get_parent (chanview)) { g_object_ref (chanview); - gtk_container_remove (GTK_CONTAINER (chanview->parent), chanview); + gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (chanview)), chanview); unref_chanview = TRUE; } @@ -3036,7 +3028,7 @@ mg_create_entry (session *sess, GtkWidget *box) gui->nick_label = but = gtk_button_new_with_label (sess->server->nick); gtk_button_set_relief (GTK_BUTTON (but), GTK_RELIEF_NONE); - GTK_WIDGET_UNSET_FLAGS (but, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (but, FALSE); gtk_box_pack_end (GTK_BOX (gui->nick_box), but, 0, 0, 0); g_signal_connect (G_OBJECT (but), "clicked", G_CALLBACK (mg_nickclick_cb), NULL); @@ -3517,7 +3509,7 @@ fe_update_mode_buttons (session *sess, char mode, char sign) if (!sess->gui->is_tab || sess == current_tab) { ignore_chanmode = TRUE; - if (GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i])->active != state) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i])) != state) gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (sess->gui->flag_wid[i]), state); ignore_chanmode = FALSE; @@ -3561,7 +3553,7 @@ fe_set_away (server *serv) { if (!sess->gui->is_tab || sess == current_tab) { - GTK_CHECK_MENU_ITEM (sess->gui->menu_item[MENU_ID_AWAY])->active = serv->is_away; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (sess->gui->menu_item[MENU_ID_AWAY]), serv->is_away); /* gray out my nickname */ mg_set_myself_away (sess->gui, serv->is_away); } @@ -3774,9 +3766,9 @@ is_child_of (GtkWidget *widget, GtkWidget *parent) { while (widget) { - if (widget->parent == parent) + if (gtk_widget_get_parent (widget) == parent) return TRUE; - widget = widget->parent; + widget = gtk_widget_get_parent (widget); } return FALSE; } @@ -3787,7 +3779,7 @@ mg_handle_drop (GtkWidget *widget, int y, int *pos, int *other_pos) int height; session_gui *gui = current_sess->gui; - gdk_drawable_get_size (widget->window, NULL, &height); + gdk_drawable_get_size (gtk_widget_get_window (widget), NULL, &height); if (y < height / 2) { @@ -3832,10 +3824,10 @@ mg_is_gui_target (GdkDragContext *context) { char *target_name; - if (!context || !context->targets || !context->targets->data) + if (!context || !gdk_drag_context_list_targets (context) || !gdk_drag_context_list_targets (context)->data) return FALSE; - target_name = gdk_atom_name (context->targets->data); + target_name = gdk_atom_name (gdk_drag_context_list_targets (context)->data); if (target_name) { /* if it's not HEXCHAT_CHANVIEW or HEXCHAT_USERLIST */ @@ -3900,7 +3892,7 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint if (!mg_is_gui_target (context)) return FALSE; - switch (context->action) + switch (gdk_drag_context_get_selected_action (context)) { case GDK_ACTION_MOVE: /* from userlist */ @@ -3927,10 +3919,8 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui GdkGCValues val; int half, width, height; int ox, oy; -#if 0 - GtkPaned *paned; -#endif GdkDrawable *draw; + GtkAllocation allocation; /* ignore file drops */ if (!mg_is_gui_target (context)) @@ -3938,24 +3928,25 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui if (scbar) /* scrollbar */ { - ox = widget->allocation.x; - oy = widget->allocation.y; - width = widget->allocation.width; - height = widget->allocation.height; - draw = widget->window; + gtk_widget_get_allocation (widget, &allocation); + ox = allocation.x; + oy = allocation.y; + width = allocation.width; + height = allocation.height; + draw = gtk_widget_get_window (widget); } else { ox = oy = 0; - gdk_drawable_get_size (widget->window, &width, &height); - draw = widget->window; + gdk_drawable_get_size (gtk_widget_get_window (widget), &width, &height); + draw = gtk_widget_get_window (widget); } val.subwindow_mode = GDK_INCLUDE_INFERIORS; val.graphics_exposures = 0; val.function = GDK_XOR; - gc = gdk_gc_new_with_values (widget->window, &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION); + gc = gdk_gc_new_with_values (gtk_widget_get_window (widget), &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION); col.red = rand() % 0xffff; col.green = rand() % 0xffff; col.blue = rand() % 0xffff; diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 07b6cd66..a338728d 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -297,9 +297,9 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags, { item = gtk_menu_item_new_with_label (""); if (flags & XCMENU_MNEMONIC) - gtk_label_set_markup_with_mnemonic (GTK_LABEL (GTK_BIN (item)->child), label); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label); else - gtk_label_set_markup (GTK_LABEL (GTK_BIN (item)->child), label); + gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), label); } else { if (flags & XCMENU_MNEMONIC) @@ -348,7 +348,7 @@ menu_quick_sub (char *name, GtkWidget *menu, GtkWidget **sub_item_ret, int flags if (flags & XCMENU_MARKUP) { sub_item = gtk_menu_item_new_with_label (""); - gtk_label_set_markup (GTK_LABEL (GTK_BIN (sub_item)->child), name); + gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (sub_item))), name); } else { @@ -388,7 +388,7 @@ toggle_cb (GtkWidget *item, char *pref_name) { char buf[256]; - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) snprintf (buf, sizeof (buf), "set %s 1", pref_name); else snprintf (buf, sizeof (buf), "set %s 0", pref_name); @@ -700,7 +700,7 @@ fe_userlist_update (session *sess, struct User *user) g_signal_handlers_disconnect_by_func (nick_submenu, menu_nickinfo_cb, sess); /* destroy all the old items */ - items = ((GtkMenuShell *) nick_submenu)->children; + items = gtk_container_get_children (GTK_CONTAINER (nick_submenu)); while (items) { next = items->next; @@ -832,7 +832,7 @@ menu_setting_foreach (void (*callback) (session *), int id, guint state) if (sess->gui->is_tab) maindone = TRUE; if (id != -1) - GTK_CHECK_MENU_ITEM (sess->gui->menu_item[id])->active = state; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (sess->gui->menu_item[id]), state); if (callback) callback (sess); } @@ -1143,7 +1143,7 @@ usermenu_create (GtkWidget *menu) static void usermenu_destroy (GtkWidget * menu) { - GList *items = ((GtkMenuShell *) menu)->children; + GList *items = gtk_container_get_children (GTK_CONTAINER (menu)); GList *next; while (items) @@ -1332,7 +1332,7 @@ menu_join_cb (GtkWidget *dialog, gint response, GtkEntry *entry) switch (response) { case GTK_RESPONSE_ACCEPT: - menu_chan_join (NULL, entry->text); + menu_chan_join (NULL, (char *)gtk_entry_get_text (entry)); break; case GTK_RESPONSE_HELP: @@ -1360,12 +1360,12 @@ menu_join (GtkWidget * wid, gpointer none) GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE); + gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); hbox = gtk_hbox_new (TRUE, 0); entry = gtk_entry_new (); - GTK_ENTRY (entry)->editable = 0; /* avoid auto-selection */ + gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); /* avoid auto-selection */ gtk_entry_set_text (GTK_ENTRY (entry), "#"); g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (menu_join_entry_cb), dialog); @@ -1377,7 +1377,7 @@ menu_join (GtkWidget * wid, gpointer none) g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (menu_join_cb), entry); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox); gtk_widget_show_all (dialog); @@ -1388,7 +1388,7 @@ menu_join (GtkWidget * wid, gpointer none) static void menu_away (GtkCheckMenuItem *item, gpointer none) { - handle_command (current_sess, item->active ? "away" : "back", FALSE); + handle_command (current_sess, gtk_check_menu_item_get_active (item) ? "away" : "back", FALSE); } static void @@ -1583,7 +1583,7 @@ static void menu_layout_cb (GtkWidget *item, gpointer none) { prefs.hex_gui_tab_layout = 2; - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) prefs.hex_gui_tab_layout = 0; menu_change_layout (); @@ -1598,7 +1598,7 @@ menu_apply_metres_cb (session *sess) static void menu_metres_off (GtkWidget *item, gpointer none) { - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) { prefs.hex_gui_lagometer = 0; prefs.hex_gui_throttlemeter = 0; @@ -1609,7 +1609,7 @@ menu_metres_off (GtkWidget *item, gpointer none) static void menu_metres_text (GtkWidget *item, gpointer none) { - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) { prefs.hex_gui_lagometer = 2; prefs.hex_gui_throttlemeter = 2; @@ -1620,7 +1620,7 @@ menu_metres_text (GtkWidget *item, gpointer none) static void menu_metres_graph (GtkWidget *item, gpointer none) { - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) { prefs.hex_gui_lagometer = 1; prefs.hex_gui_throttlemeter = 1; @@ -1631,7 +1631,7 @@ menu_metres_graph (GtkWidget *item, gpointer none) static void menu_metres_both (GtkWidget *item, gpointer none) { - if (GTK_CHECK_MENU_ITEM (item)->active) + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) { prefs.hex_gui_lagometer = 3; prefs.hex_gui_throttlemeter = 3; @@ -1827,7 +1827,7 @@ menu_canacaccel (GtkWidget *widget, guint signal_id, gpointer user_data) static GtkMenuItem * menu_find_item (GtkWidget *menu, char *name) { - GList *items = ((GtkMenuShell *) menu)->children; + GList *items = gtk_container_get_children (GTK_CONTAINER (menu)); GtkMenuItem *item; GtkWidget *child; const char *labeltext; @@ -1835,7 +1835,7 @@ menu_find_item (GtkWidget *menu, char *name) while (items) { item = items->data; - child = GTK_BIN (item)->child; + child = gtk_bin_get_child (GTK_BIN (item)); if (child) /* separators arn't labels, skip them */ { labeltext = g_object_get_data (G_OBJECT (item), "name"); @@ -1932,7 +1932,7 @@ menu_update_cb (GtkWidget *menu, menu_entry *me, char *target) gtk_widget_set_sensitive (item, me->enable); /* must do it without triggering the callback */ if (GTK_IS_CHECK_MENU_ITEM (item)) - GTK_CHECK_MENU_ITEM (item)->active = me->state; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), me->state); } } @@ -1941,7 +1941,7 @@ static void menu_radio_cb (GtkCheckMenuItem *item, menu_entry *me) { me->state = 0; - if (item->active) + if (gtk_check_menu_item_get_active (item)) me->state = 1; /* update the state, incase this was changed via right-click. */ @@ -1957,7 +1957,7 @@ static void menu_toggle_cb (GtkCheckMenuItem *item, menu_entry *me) { me->state = 0; - if (item->active) + if (gtk_check_menu_item_get_active (item)) me->state = 1; /* update the state, incase this was changed via right-click. */ @@ -1999,7 +1999,7 @@ menu_reorder (GtkMenu *menu, GtkWidget *item, int pos) return; if (pos < 0) /* position offset from end/bottom */ - gtk_menu_reorder_child (menu, item, (g_list_length (GTK_MENU_SHELL (menu)->children) + pos) - 1); + gtk_menu_reorder_child (menu, item, (g_list_length (gtk_container_get_children (GTK_CONTAINER (menu))) + pos) - 1); else gtk_menu_reorder_child (menu, item, pos); } @@ -2065,7 +2065,7 @@ menu_add_sub (GtkWidget *menu, menu_entry *me) { pos = me->pos; if (pos < 0) /* position offset from end/bottom */ - pos = g_list_length (GTK_MENU_SHELL (menu)->children) + pos; + pos = g_list_length (gtk_container_get_children (GTK_CONTAINER (menu))) + pos; menu_quick_sub (me->label, menu, &item, me->markup ? XCMENU_MARKUP|XCMENU_MNEMONIC : XCMENU_MNEMONIC, pos); } return item; @@ -2333,7 +2333,7 @@ normalitem: item = gtk_check_menu_item_new_with_mnemonic (_(mymenu[i].text)); togitem: /* must avoid callback for Radio buttons */ - GTK_CHECK_MENU_ITEM (item)->active = mymenu[i].state; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), mymenu[i].state); /*gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), mymenu[i].state);*/ if (mymenu[i].key != 0) diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c index c0282ade..e50661d5 100644 --- a/src/fe-gtk/notifygui.c +++ b/src/fe-gtk/notifygui.c @@ -311,10 +311,10 @@ notifygui_add_cb (GtkDialog *dialog, gint response, gpointer entry) char *networks; char *text; - text = GTK_ENTRY (entry)->text; + text = (char *)gtk_entry_get_text (GTK_ENTRY (entry)); if (text[0] && response == GTK_RESPONSE_ACCEPT) { - networks = GTK_ENTRY (g_object_get_data (G_OBJECT (entry), "net"))->text; + networks = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (entry), "net"))); if (g_ascii_strcasecmp (networks, "ALL") == 0 || networks[0] == 0) notify_adduser (text, NULL); else @@ -353,7 +353,7 @@ fe_notify_ask (char *nick, char *networks) gtk_container_set_border_width (GTK_CONTAINER (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 3); gtk_table_set_col_spacings (GTK_TABLE (table), 8); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table); label = gtk_label_new (msg); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index aa0b0cee..f4fba64e 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -555,7 +555,7 @@ tray_make_item (GtkWidget *menu, char *label, void *callback, void *userdata) static void tray_toggle_cb (GtkCheckMenuItem *item, unsigned int *setting) { - *setting = item->active; + *setting = gtk_check_menu_item_get_active (item); } static void diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c index e1292259..9fd09419 100644 --- a/src/fe-gtk/servlistgui.c +++ b/src/fe-gtk/servlistgui.c @@ -671,10 +671,10 @@ servlist_update_from_entry (char **str, GtkWidget *entry) if (*str) free (*str); - if (GTK_ENTRY (entry)->text[0] == 0) + if (gtk_entry_get_text (GTK_ENTRY (entry))[0] == 0) *str = NULL; else - *str = strdup (GTK_ENTRY (entry)->text); + *str = strdup (gtk_entry_get_text (GTK_ENTRY (entry))); } static void @@ -946,20 +946,20 @@ servlist_savegui (void) char *sp; /* check for blank username, ircd will not allow this */ - if (GTK_ENTRY (entry_guser)->text[0] == 0) + if (gtk_entry_get_text (GTK_ENTRY (entry_guser))[0] == 0) return 1; - /* if (GTK_ENTRY (entry_greal)->text[0] == 0) + /* if (gtk_entry_get_text (GTK_ENTRY (entry_greal))[0] == 0) return 1; */ - strcpy (prefs.hex_irc_nick1, GTK_ENTRY (entry_nick1)->text); - strcpy (prefs.hex_irc_nick2, GTK_ENTRY (entry_nick2)->text); - strcpy (prefs.hex_irc_nick3, GTK_ENTRY (entry_nick3)->text); - strcpy (prefs.hex_irc_user_name, GTK_ENTRY (entry_guser)->text); + strcpy (prefs.hex_irc_nick1, gtk_entry_get_text (GTK_ENTRY (entry_nick1))); + strcpy (prefs.hex_irc_nick2, gtk_entry_get_text (GTK_ENTRY (entry_nick2))); + strcpy (prefs.hex_irc_nick3, gtk_entry_get_text (GTK_ENTRY (entry_nick3))); + strcpy (prefs.hex_irc_user_name, gtk_entry_get_text (GTK_ENTRY (entry_guser))); sp = strchr (prefs.hex_irc_user_name, ' '); if (sp) sp[0] = 0; /* spaces will break the login */ - /* strcpy (prefs.hex_irc_real_name, GTK_ENTRY (entry_greal)->text); */ + /* strcpy (prefs.hex_irc_real_name, gtk_entry_get_text (GTK_ENTRY (entry_greal))); */ servlist_save (); save_config (); /* For nicks stored in hexchat.conf */ @@ -1208,13 +1208,13 @@ servlist_check_cb (GtkWidget *but, gpointer num_p) if ((1 << num) == FLAG_CYCLE || (1 << num) == FLAG_USE_PROXY) { /* these ones are reversed, so it's compat with 2.0.x */ - if (GTK_TOGGLE_BUTTON (but)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (but))) selected_net->flags &= ~(1 << num); else selected_net->flags |= (1 << num); } else { - if (GTK_TOGGLE_BUTTON (but)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (but))) selected_net->flags |= (1 << num); else selected_net->flags &= ~(1 << num); @@ -1222,7 +1222,7 @@ servlist_check_cb (GtkWidget *but, gpointer num_p) if ((1 << num) == FLAG_USE_GLOBAL) { - servlist_toggle_global_user (!GTK_TOGGLE_BUTTON (but)->active); + servlist_toggle_global_user (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (but))); } } @@ -1496,7 +1496,7 @@ servlist_combo_cb (GtkEntry *entry, gpointer userdata) if (selected_net->encoding) free (selected_net->encoding); - selected_net->encoding = strdup (entry->text); + selected_net->encoding = strdup (gtk_entry_get_text (entry)); } /* Fills up the network's authentication type so that it's guaranteed to be either NULL or a valid value. */ @@ -1549,7 +1549,7 @@ servlist_create_charsetcombo (void) gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN(cb))), selected_net->encoding ? selected_net->encoding : "System default"); - g_signal_connect (G_OBJECT (GTK_BIN (cb)->child), "changed", + g_signal_connect (G_OBJECT (gtk_bin_get_child (GTK_BIN (cb))), "changed", G_CALLBACK (servlist_combo_cb), NULL); return cb; @@ -1582,7 +1582,7 @@ servlist_create_logintypecombo (GtkWidget *data) static void no_servlist (GtkWidget * igad, gpointer serv) { - if (GTK_TOGGLE_BUTTON (igad)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (igad))) prefs.hex_gui_slist_skip = TRUE; else prefs.hex_gui_slist_skip = FALSE; @@ -1591,7 +1591,7 @@ no_servlist (GtkWidget * igad, gpointer serv) static void fav_servlist (GtkWidget * igad, gpointer serv) { - if (GTK_TOGGLE_BUTTON (igad)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (igad))) prefs.hex_gui_slist_fav = TRUE; else prefs.hex_gui_slist_fav = FALSE; @@ -1711,7 +1711,6 @@ servlist_open_edit (GtkWidget *parent, ircnet *net) "editable", 1, NULL); - /* Channel Tree */ store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); model = GTK_TREE_MODEL (store); @@ -1784,19 +1783,19 @@ servlist_open_edit (GtkWidget *parent, ircnet *net) g_signal_connect (G_OBJECT (buttonadd), "clicked", G_CALLBACK (servlist_addbutton_cb), notebook); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonadd); - GTK_WIDGET_SET_FLAGS (buttonadd, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (buttonadd, TRUE); buttonremove = gtk_button_new_from_stock ("gtk-remove"); g_signal_connect (G_OBJECT (buttonremove), "clicked", G_CALLBACK (servlist_deletebutton_cb), notebook); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonremove); - GTK_WIDGET_SET_FLAGS (buttonremove, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (buttonremove, TRUE); buttonedit = gtk_button_new_with_mnemonic (_("_Edit")); g_signal_connect (G_OBJECT (buttonedit), "clicked", G_CALLBACK (servlist_editbutton_cb), notebook); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonedit); - GTK_WIDGET_SET_FLAGS (buttonedit, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (buttonedit, TRUE); /* Checkboxes and entries */ @@ -1854,7 +1853,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net) g_signal_connect (G_OBJECT (button10), "clicked", G_CALLBACK (servlist_edit_close_cb), 0); gtk_container_add (GTK_CONTAINER (hbuttonbox4), button10); - GTK_WIDGET_SET_FLAGS (button10, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button10, TRUE); if (net->flags & FLAG_USE_GLOBAL) { @@ -2089,21 +2088,21 @@ servlist_open_networks (void) G_CALLBACK (servlist_addnet_cb), networks_tree); gtk_widget_show (button_add); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_add); - GTK_WIDGET_SET_FLAGS (button_add, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_add, TRUE); button_remove = gtk_button_new_from_stock ("gtk-remove"); g_signal_connect (G_OBJECT (button_remove), "clicked", G_CALLBACK (servlist_deletenet_cb), 0); gtk_widget_show (button_remove); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_remove); - GTK_WIDGET_SET_FLAGS (button_remove, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_remove, TRUE); button_edit = gtk_button_new_with_mnemonic (_("_Edit...")); g_signal_connect (G_OBJECT (button_edit), "clicked", G_CALLBACK (servlist_edit_cb), 0); gtk_widget_show (button_edit); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_edit); - GTK_WIDGET_SET_FLAGS (button_edit, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_edit, TRUE); button_sort = gtk_button_new_with_mnemonic (_("_Sort")); add_tip (button_sort, _("Sorts the network list in alphabetical order. " @@ -2112,7 +2111,7 @@ servlist_open_networks (void) G_CALLBACK (servlist_sort), 0); gtk_widget_show (button_sort); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_sort); - GTK_WIDGET_SET_FLAGS (button_sort, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_sort, TRUE); button_sort = gtk_button_new_with_mnemonic (_("_Favor")); add_tip (button_sort, _("Mark or unmark this network as a favorite.")); @@ -2120,7 +2119,7 @@ servlist_open_networks (void) G_CALLBACK (servlist_favor), 0); gtk_widget_show (button_sort); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_sort); - GTK_WIDGET_SET_FLAGS (button_sort, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_sort, TRUE); hseparator1 = gtk_hseparator_new (); gtk_widget_show (hseparator1); @@ -2136,11 +2135,11 @@ servlist_open_networks (void) g_signal_connect (G_OBJECT (button_close), "clicked", G_CALLBACK (servlist_close_cb), 0); gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_close); - GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_close, TRUE); button_connect = gtkutil_button (hbuttonbox1, GTK_STOCK_CONNECT, NULL, servlist_connect_cb, NULL, _("C_onnect")); - GTK_WIDGET_SET_FLAGS (button_connect, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button_connect, TRUE); gtk_label_set_mnemonic_widget (GTK_LABEL (label3), entry1); gtk_label_set_mnemonic_widget (GTK_LABEL (label6), entry4); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 8b3a43e5..d93841d9 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -635,7 +635,7 @@ static const setting network_settings[] = static void setup_3oggle_cb (GtkToggleButton *but, unsigned int *setting) { - *setting = but->active; + *setting = gtk_toggle_button_get_active (but); } static void @@ -708,15 +708,15 @@ setup_toggle_cb (GtkToggleButton *but, const setting *set) { GtkWidget *label, *disable_wid; - setup_set_int (&setup_prefs, set, but->active ? 1 : 0); + setup_set_int (&setup_prefs, set, gtk_toggle_button_get_active (but)); /* does this toggle also enable/disable another widget? */ disable_wid = g_object_get_data (G_OBJECT (but), "nxt"); if (disable_wid) { - gtk_widget_set_sensitive (disable_wid, but->active); + gtk_widget_set_sensitive (disable_wid, gtk_toggle_button_get_active (but)); label = g_object_get_data (G_OBJECT (disable_wid), "lbl"); - gtk_widget_set_sensitive (label, but->active); + gtk_widget_set_sensitive (label, gtk_toggle_button_get_active (but)); } } @@ -904,7 +904,7 @@ setup_menu_cb (GtkWidget *cbox, const setting *set) static void setup_radio_cb (GtkWidget *item, const setting *set) { - if (GTK_TOGGLE_BUTTON (item)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item))) { int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "n")); /* set the prefs.<field> */ @@ -1110,7 +1110,7 @@ setup_fontsel_cancel (GtkWidget *button, GtkFontSelectionDialog *dialog) static void setup_browsefolder_cb (GtkWidget *button, GtkEntry *entry) { - gtkutil_file_req (_("Select Download Folder"), setup_filereq_cb, entry, entry->text, NULL, FRF_CHOOSEFOLDER); + gtkutil_file_req (_("Select Download Folder"), setup_filereq_cb, entry, (char*)gtk_entry_get_text (entry), NULL, FRF_CHOOSEFOLDER); } static void @@ -1124,8 +1124,8 @@ setup_browsefont_cb (GtkWidget *button, GtkWidget *entry) sel = (GtkFontSelection *) dialog->fontsel; - if (GTK_ENTRY (entry)->text[0]) - gtk_font_selection_set_font_name (sel, GTK_ENTRY (entry)->text); + if (gtk_entry_get_text (GTK_ENTRY (entry))[0]) + gtk_font_selection_set_font_name (sel, gtk_entry_get_text (GTK_ENTRY (entry))); g_object_set_data (G_OBJECT (dialog->ok_button), "e", entry); @@ -1144,8 +1144,8 @@ setup_entry_cb (GtkEntry *entry, setting *set) { int size; int pos; - int len = strlen (entry->text); - unsigned char *p = entry->text; + int len = gtk_entry_get_text_length (entry); + unsigned char *p = (unsigned char*)gtk_entry_get_text (entry); /* need to truncate? */ if (len >= set->extra) @@ -1167,7 +1167,7 @@ setup_entry_cb (GtkEntry *entry, setting *set) } else { - setup_set_str (&setup_prefs, set, entry->text); + setup_set_str (&setup_prefs, set, gtk_entry_get_text (entry)); } } @@ -1449,7 +1449,7 @@ setup_create_color_button (GtkWidget *table, int num, int row, int col) /* 12345678901 23456789 01 23456789 */ sprintf (buf, "<span size=\"x-small\">%d</span>", num); but = gtk_button_new_with_label (" "); - gtk_label_set_markup (GTK_LABEL (GTK_BIN (but)->child), buf); + gtk_label_set_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (but))), buf); /* win32 build uses this to turn off themeing */ g_object_set_data (G_OBJECT (but), "hexchat-color", (gpointer)1); gtk_table_attach (GTK_TABLE (table), but, col, col+1, row, row+1, @@ -1693,7 +1693,7 @@ setup_snd_browse_cb (GtkWidget *button, GtkEntry *entry) static void setup_snd_play_cb (GtkWidget *button, GtkEntry *entry) { - sound_play (entry->text, FALSE); + sound_play (gtk_entry_get_text (entry), FALSE); } static void @@ -1715,7 +1715,7 @@ setup_snd_changed_cb (GtkEntry *ent, GtkTreeView *tree) /* get the new sound file */ if (sound_files[n]) free (sound_files[n]); - sound_files[n] = strdup (GTK_ENTRY (ent)->text); + sound_files[n] = strdup (gtk_entry_get_text (GTK_ENTRY (ent))); /* update the TreeView list */ store = (GtkListStore *)gtk_tree_view_get_model (tree); diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 2d83fb86..4736020d 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -420,7 +420,7 @@ replace_word(GtkWidget *menuitem, SexySpellEntry *entry) get_word_extents_from_position(entry, &start, &end, entry->priv->mark_character); oldword = gtk_editable_get_chars(GTK_EDITABLE(entry), start, end); - newword = gtk_label_get_text(GTK_LABEL(GTK_BIN(menuitem)->child)); + newword = gtk_label_get_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(menuitem)))); cursor = gtk_editable_get_position(GTK_EDITABLE(entry)); /* is the cursor at the end? If so, restore it there */ @@ -821,7 +821,7 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry) rect.x = 0; rect.y = 0; rect.width = widget->allocation.width; rect.height = widget->allocation.height; - gdk_window_invalidate_rect(widget->window, &rect, TRUE); + gdk_window_invalidate_rect(gtk_widget_get_window (widget), &rect, TRUE); } } @@ -1338,7 +1338,7 @@ sexy_spell_entry_set_checked(SexySpellEntry *entry, gboolean checked) rect.x = 0; rect.y = 0; rect.width = widget->allocation.width; rect.height = widget->allocation.height; - gdk_window_invalidate_rect(widget->window, &rect, TRUE); + gdk_window_invalidate_rect(gtk_widget_get_window (widget), &rect, TRUE); } else { if (entry->priv->words) { g_strfreev(entry->priv->words); diff --git a/src/fe-gtk/userlistgui.c b/src/fe-gtk/userlistgui.c index eca97e6b..5a18d8b8 100644 --- a/src/fe-gtk/userlistgui.c +++ b/src/fe-gtk/userlistgui.c @@ -274,7 +274,7 @@ userlist_set_value (GtkWidget *treeview, gfloat val) gfloat userlist_get_value (GtkWidget *treeview) { - return gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (treeview))->value; + return gtk_adjustment_get_value (gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (treeview))); } int @@ -425,7 +425,7 @@ userlist_dnd_drop (GtkTreeView *widget, GdkDragContext *context, return; gtk_tree_model_get (model, &iter, COL_USER, &user, -1); - mg_dnd_drop_file (current_sess, user->nick, selection_data->data); + mg_dnd_drop_file (current_sess, user->nick, (char *)gtk_selection_data_get_data (selection_data)); } static gboolean |