[gedit] Use gtk accessor functions instead direct access
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit] Use gtk accessor functions instead direct access
- Date: Mon, 31 Aug 2009 21:03:46 +0000 (UTC)
commit aedc0f5a61260267267ee9c2fe236bd9b50963e4
Author: Javier Jardón <javierjc1982 gmail com>
Date: Mon Aug 31 14:01:35 2009 +0200
Use gtk accessor functions instead direct access
First batch of Bug #593601. Some functions still remaining because there
is not API in GTK+ yet
gedit/dialogs/gedit-close-confirmation-dialog.c | 7 +++--
gedit/dialogs/gedit-encodings-dialog.c | 12 +++++---
gedit/dialogs/gedit-preferences-dialog.c | 10 +++---
gedit/dialogs/gedit-search-dialog.c | 13 +++++---
gedit/gedit-encodings-option-menu.c | 17 +++++------
gedit/gedit-notebook.c | 2 +-
gedit/gedit-plugins-engine.c | 2 +-
gedit/gedit-print-preview.c | 20 +++++++++-----
gedit/gedit-statusbar.c | 4 ++-
gedit/gedit-utils.c | 4 +-
gedit/gedit-window.c | 9 ++++--
gedit/gedit.c | 4 +-
plugins/filebrowser/gedit-file-browser-view.c | 11 +++++---
plugins/filebrowser/gedit-file-browser-widget.c | 11 ++++---
plugins/spell/gedit-automatic-spell-checker.c | 33 ++++++++++++++++-------
plugins/spell/gedit-spell-checker-dialog.c | 2 +-
plugins/spell/gedit-spell-language-dialog.c | 13 +++++---
plugins/time/gedit-time-plugin.c | 14 +++++----
18 files changed, 113 insertions(+), 75 deletions(-)
---
diff --git a/gedit/dialogs/gedit-close-confirmation-dialog.c b/gedit/dialogs/gedit-close-confirmation-dialog.c
index 1c55555..336d5ac 100644
--- a/gedit/dialogs/gedit-close-confirmation-dialog.c
+++ b/gedit/dialogs/gedit-close-confirmation-dialog.c
@@ -196,7 +196,8 @@ gedit_close_confirmation_dialog_init (GeditCloseConfirmationDialog *dlg)
& GEDIT_LOCKDOWN_SAVE_TO_DISK;
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 14);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 14);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE);
@@ -553,7 +554,7 @@ build_single_doc_dialog (GeditCloseConfirmationDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
hbox,
FALSE,
FALSE,
@@ -676,7 +677,7 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
hbox, TRUE, TRUE, 0);
/* Image */
diff --git a/gedit/dialogs/gedit-encodings-dialog.c b/gedit/dialogs/gedit-encodings-dialog.c
index 64471e3..dfe1323 100644
--- a/gedit/dialogs/gedit-encodings-dialog.c
+++ b/gedit/dialogs/gedit-encodings-dialog.c
@@ -324,9 +324,11 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
gtk_dialog_set_default_response (GTK_DIALOG (dlg),
GTK_RESPONSE_OK);
@@ -352,14 +354,14 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
{
gtk_widget_show (error_widget);
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget);
gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
return;
}
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
content, TRUE, TRUE, 0);
g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
diff --git a/gedit/dialogs/gedit-preferences-dialog.c b/gedit/dialogs/gedit-preferences-dialog.c
index 9f52ac1..252ed38 100644
--- a/gedit/dialogs/gedit-preferences-dialog.c
+++ b/gedit/dialogs/gedit-preferences-dialog.c
@@ -1091,9 +1091,9 @@ gedit_preferences_dialog_init (GeditPreferencesDialog *dlg)
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
g_signal_connect (dlg,
"response",
@@ -1145,13 +1145,13 @@ gedit_preferences_dialog_init (GeditPreferencesDialog *dlg)
{
gtk_widget_show (error_widget);
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget);
return;
}
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
dlg->priv->notebook, FALSE, FALSE, 0);
g_object_unref (dlg->priv->notebook);
gtk_container_set_border_width (GTK_CONTAINER (dlg->priv->notebook), 5);
diff --git a/gedit/dialogs/gedit-search-dialog.c b/gedit/dialogs/gedit-search-dialog.c
index 619db84..b434dfb 100644
--- a/gedit/dialogs/gedit-search-dialog.c
+++ b/gedit/dialogs/gedit-search-dialog.c
@@ -338,9 +338,12 @@ gedit_search_dialog_init (GeditSearchDialog *dlg)
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 6);
file = gedit_dirs_get_ui_file ("gedit-search-dialog.ui");
ret = gedit_utils_get_ui_objects (file,
@@ -361,7 +364,7 @@ gedit_search_dialog_init (GeditSearchDialog *dlg)
{
gtk_widget_show (error_widget);
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget);
gtk_container_set_border_width (GTK_CONTAINER (error_widget),
5);
@@ -439,7 +442,7 @@ gedit_search_dialog_init (GeditSearchDialog *dlg)
GEDIT_SEARCH_DIALOG_REPLACE_ALL_RESPONSE,
FALSE);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
content, FALSE, FALSE, 0);
g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
diff --git a/gedit/gedit-encodings-option-menu.c b/gedit/gedit-encodings-option-menu.c
index c9e6a74..e136655 100644
--- a/gedit/gedit-encodings-option-menu.c
+++ b/gedit/gedit-encodings-option-menu.c
@@ -173,7 +173,7 @@ add_or_remove (GtkMenuItem *menu_item,
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
- wg = GTK_WINDOW (toplevel)->group;
+ wg = gtk_window_get_group (GTK_WINDOW (toplevel));
if (wg == NULL)
{
wg = gtk_window_group_new ();
@@ -384,6 +384,7 @@ gedit_encodings_option_menu_set_selected_encoding (GeditEncodingsOptionMenu *men
{
GtkOptionMenu *option_menu;
GList *list;
+ GList *l;
gint i;
g_return_if_fail (GEDIT_IS_ENCODINGS_OPTION_MENU (menu));
@@ -391,14 +392,14 @@ gedit_encodings_option_menu_set_selected_encoding (GeditEncodingsOptionMenu *men
option_menu = GTK_OPTION_MENU (menu);
g_return_if_fail (option_menu != NULL);
- list = GTK_MENU_SHELL (option_menu->menu)->children;
+ list = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
i = 0;
- while (list != NULL)
+ for (l = list; l != NULL; l = g_list_next (l))
{
GtkWidget *menu_item;
const GeditEncoding *enc;
- menu_item = GTK_WIDGET (list->data);
+ menu_item = GTK_WIDGET (l->data);
enc = (const GeditEncoding *)g_object_get_data (G_OBJECT (menu_item),
ENCODING_KEY);
@@ -406,14 +407,12 @@ gedit_encodings_option_menu_set_selected_encoding (GeditEncodingsOptionMenu *men
if (enc == encoding)
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
-
gtk_option_menu_set_history (GTK_OPTION_MENU (menu), i);
-
- return;
+ break;
}
++i;
-
- list = g_list_next (list);
}
+
+ g_list_free (list);
}
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index 890d379..74ac1ac 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -388,7 +388,7 @@ drag_start (GeditNotebook *notebook,
/* FIXME multi-head */
if (!gdk_pointer_is_grabbed ())
{
- gdk_pointer_grab (GTK_WIDGET (notebook)->window,
+ gdk_pointer_grab (gtk_widget_get_window (GTK_WIDGET (notebook)),
FALSE,
GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL,
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index d3d5270..3f020d3 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -806,7 +806,7 @@ gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
parent);
- wg = parent->group;
+ wg = gtk_window_get_group (parent);
if (wg == NULL)
{
wg = gtk_window_group_new ();
diff --git a/gedit/gedit-print-preview.c b/gedit/gedit-print-preview.c
index 6240462..7926987 100644
--- a/gedit/gedit-print-preview.c
+++ b/gedit/gedit-print-preview.c
@@ -717,6 +717,7 @@ get_page_at_coords (GeditPrintPreview *preview,
gint y)
{
GeditPrintPreviewPrivate *priv;
+ GtkAdjustment *hadj, *vadj;
gint r, c, pg;
priv = preview->priv;
@@ -724,8 +725,11 @@ get_page_at_coords (GeditPrintPreview *preview,
if (priv->tile_h <= 0 || priv->tile_h <= 0)
return -1;
- x += gtk_layout_get_hadjustment (GTK_LAYOUT (priv->layout))->value;
- y += gtk_layout_get_vadjustment (GTK_LAYOUT (priv->layout))->value;
+ hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (priv->layout));
+ vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (priv->layout));
+
+ x += gtk_adjustment_get_value (hadj);
+ y += gtk_adjustment_get_value (vadj);
r = 1 + y / (priv->tile_h);
c = 1 + x / (priv->tile_w);
@@ -786,8 +790,8 @@ preview_layout_key_press (GtkWidget *widget,
hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (priv->layout));
vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (priv->layout));
- x = hadj->value;
- y = vadj->value;
+ x = gtk_adjustment_get_value (hadj);
+ y = gtk_adjustment_get_value (vadj);
g_object_get (hadj,
"lower", &hlower,
@@ -1103,17 +1107,19 @@ preview_expose (GtkWidget *widget,
GdkEventExpose *event,
GeditPrintPreview *preview)
{
- GeditPrintPreviewPrivate *priv;
+ GeditPrintPreviewPrivate *priv;
+ GdkWindow *bin_window;
cairo_t *cr;
gint pg;
gint i, j;
priv = preview->priv;
- if (event->window != GTK_LAYOUT (priv->layout)->bin_window)
+ bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (priv->layout));
+ if (event->window != bin_window)
return FALSE;
- cr = gdk_cairo_create (GTK_LAYOUT (priv->layout)->bin_window);
+ cr = gdk_cairo_create (bin_window);
gdk_cairo_rectangle (cr, &event->area);
cairo_clip (cr);
diff --git a/gedit/gedit-statusbar.c b/gedit/gedit-statusbar.c
index 969916e..178147c 100644
--- a/gedit/gedit-statusbar.c
+++ b/gedit/gedit-statusbar.c
@@ -125,10 +125,12 @@ set_statusbar_width_chars (GtkWidget *statusbar,
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width, digit_width, width;
+ GtkStyle *style;
context = gtk_widget_get_pango_context (statusbar);
+ style = gtk_widget_get_style (GTK_WIDGET (statusbar));
metrics = pango_context_get_metrics (context,
- GTK_WIDGET (statusbar)->style->font_desc,
+ style->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_digit_width (metrics);
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 05feb2e..e522b17 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -505,7 +505,7 @@ gedit_warning (GtkWindow *parent, const gchar *format, ...)
g_return_if_fail (format != NULL);
if (parent != NULL)
- wg = parent->group;
+ wg = gtk_window_get_group (parent);
va_start (args, format);
str = g_strdup_vprintf (format, args);
@@ -1372,7 +1372,7 @@ gedit_utils_drop_get_uris (GtkSelectionData *selection_data)
gint p = 0;
gchar **uri_list;
- uris = g_uri_list_extract_uris ((gchar *) selection_data->data);
+ uris = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (selection_data));
uri_list = g_new0(gchar *, g_strv_length (uris) + 1);
for (i = 0; uris[i] != NULL; i++)
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 0f53d96..680393c 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2788,7 +2788,8 @@ fullscreen_controls_show (GeditWindow *window)
screen = gtk_window_get_screen (GTK_WINDOW (window));
gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
+ gdk_screen_get_monitor_at_window (screen,
+ gtk_widget_get_window (GTK_WIDGET (window))),
&fs_rect);
gtk_window_get_size (GTK_WINDOW (window->priv->fullscreen_controls), &w, &h);
@@ -2812,7 +2813,8 @@ run_fullscreen_animation (gpointer data)
screen = gtk_window_get_screen (GTK_WINDOW (window));
gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
+ gdk_screen_get_monitor_at_window (screen,
+ gtk_widget_get_window (GTK_WIDGET (window))),
&fs_rect);
gtk_window_get_position (GTK_WINDOW (window->priv->fullscreen_controls),
@@ -2886,7 +2888,8 @@ show_hide_fullscreen_toolbar (GeditWindow *window,
screen = gtk_window_get_screen (GTK_WINDOW (window));
gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
+ gdk_screen_get_monitor_at_window (screen,
+ gtk_widget_get_window (GTK_WIDGET (window))),
&fs_rect);
if (show)
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 2b9c2a9..cbc76a5 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -393,9 +393,9 @@ on_message_received (const char *message,
#ifdef GDK_WINDOWING_X11
if (startup_timestamp <= 0)
- startup_timestamp = gdk_x11_get_server_time (GTK_WIDGET (window)->window);
+ startup_timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
- gdk_x11_window_set_user_time (GTK_WIDGET (window)->window,
+ gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)),
startup_timestamp);
#endif
diff --git a/plugins/filebrowser/gedit-file-browser-view.c b/plugins/filebrowser/gedit-file-browser-view.c
index 9bd7fd5..661b1a9 100644
--- a/plugins/filebrowser/gedit-file-browser-view.c
+++ b/plugins/filebrowser/gedit-file-browser-view.c
@@ -256,7 +256,8 @@ enter_notify_event (GtkWidget *widget,
NULL, NULL, NULL);
if (view->priv->hover_path != NULL)
- gdk_window_set_cursor (widget->window, view->priv->hand_cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget),
+ view->priv->hand_cursor);
}
// Chainup
@@ -279,9 +280,11 @@ motion_notify_event (GtkWidget * widget,
if ((old_hover_path != NULL) != (view->priv->hover_path != NULL)) {
if (view->priv->hover_path != NULL)
- gdk_window_set_cursor (widget->window, view->priv->hand_cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget),
+ view->priv->hand_cursor);
else
- gdk_window_set_cursor (widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (widget),
+ NULL);
}
if (old_hover_path != NULL)
@@ -317,7 +320,7 @@ set_click_policy_property (GeditFileBrowserView *obj,
}
if (GTK_WIDGET_REALIZED (GTK_WIDGET (obj))) {
- win = GTK_WIDGET (obj)->window;
+ win = gtk_widget_get_window (GTK_WIDGET (obj));
gdk_window_set_cursor (win, NULL);
display = gtk_widget_get_display (GTK_WIDGET (obj));
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index 0274197..db324fa 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -1102,10 +1102,11 @@ on_begin_loading (GeditFileBrowserStore *model,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
{
- if (!GDK_IS_WINDOW (GTK_WIDGET (obj->priv->treeview)->window))
+ if (!GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview))))
return;
- gdk_window_set_cursor (GTK_WIDGET (obj)->window, obj->priv->busy_cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (obj)),
+ obj->priv->busy_cursor);
}
static void
@@ -1113,10 +1114,10 @@ on_end_loading (GeditFileBrowserStore *model,
GtkTreeIter *iter,
GeditFileBrowserWidget *obj)
{
- if (!GDK_IS_WINDOW (GTK_WIDGET (obj->priv->treeview)->window))
+ if (!GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview))))
return;
- gdk_window_set_cursor (GTK_WIDGET (obj)->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (obj)), NULL);
}
static void
@@ -2035,7 +2036,7 @@ set_busy (GeditFileBrowserWidget *obj, gboolean busy)
GdkCursor *cursor;
GdkWindow *window;
- window = GTK_WIDGET (obj->priv->treeview)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview));
if (!GDK_IS_WINDOW (window))
return;
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index e2f37f3..3488a6b 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -693,7 +693,7 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
GeditSpellChecker *checker)
{
GeditAutomaticSpellChecker *spell;
-
+ GtkTextTagTable *tag_table;
GtkTextIter start, end;
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
@@ -707,11 +707,13 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
spell->doc = doc;
spell->spell_checker = g_object_ref (checker);
- if (automatic_spell_checker_id == 0) {
+ if (automatic_spell_checker_id == 0)
+ {
automatic_spell_checker_id =
g_quark_from_string ("GeditAutomaticSpellCheckerID");
}
- if (suggestion_id == 0) {
+ if (suggestion_id == 0)
+ {
suggestion_id = g_quark_from_string ("GeditAutoSuggestionID");
}
@@ -760,20 +762,20 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
"underline", PANGO_UNDERLINE_ERROR,
NULL);
- g_return_val_if_fail (GTK_TEXT_BUFFER (doc)->tag_table != NULL, NULL);
+ tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (doc));
gtk_text_tag_set_priority (spell->tag_highlight,
- gtk_text_tag_table_get_size (GTK_TEXT_BUFFER (doc)->tag_table) - 1);
+ gtk_text_tag_table_get_size (tag_table) - 1);
- g_signal_connect (GTK_TEXT_BUFFER (doc)->tag_table,
+ g_signal_connect (tag_table,
"tag-added",
G_CALLBACK (tag_added_or_removed),
spell);
- g_signal_connect (GTK_TEXT_BUFFER (doc)->tag_table,
+ g_signal_connect (tag_table,
"tag-removed",
G_CALLBACK (tag_added_or_removed),
spell);
- g_signal_connect (GTK_TEXT_BUFFER (doc)->tag_table,
+ g_signal_connect (tag_table,
"tag-changed",
G_CALLBACK (tag_changed),
spell);
@@ -786,44 +788,55 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
"gedit-automatic-spell-checker-insert-start");
if (spell->mark_insert_start == NULL)
+ {
spell->mark_insert_start =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-start",
&start,
TRUE);
+ }
else
+ {
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_start,
&start);
+ }
spell->mark_insert_end = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-end");
if (spell->mark_insert_end == NULL)
+ {
spell->mark_insert_end =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-end",
&start,
TRUE);
+ }
else
+ {
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_insert_end,
&start);
-
+ }
spell->mark_click = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-click");
if (spell->mark_click == NULL)
+ {
spell->mark_click =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-click",
&start,
TRUE);
+ }
else
+ {
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc),
spell->mark_click,
&start);
+ }
spell->deferred_check = FALSE;
@@ -862,7 +875,7 @@ gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
g_return_if_fail (spell != NULL);
- table = GTK_TEXT_BUFFER (spell->doc)->tag_table;
+ table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (spell->doc));
if (table != NULL)
{
diff --git a/plugins/spell/gedit-spell-checker-dialog.c b/plugins/spell/gedit-spell-checker-dialog.c
index 3ccdc65..71ea9d8 100644
--- a/plugins/spell/gedit-spell-checker-dialog.c
+++ b/plugins/spell/gedit-spell-checker-dialog.c
@@ -265,7 +265,7 @@ create_dialog (GeditSpellCheckerDialog *dlg,
{
gtk_widget_show (error_widget);
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget);
return;
diff --git a/plugins/spell/gedit-spell-language-dialog.c b/plugins/spell/gedit-spell-language-dialog.c
index c95741d..fb5d6db 100644
--- a/plugins/spell/gedit-spell-language-dialog.c
+++ b/plugins/spell/gedit-spell-language-dialog.c
@@ -145,9 +145,12 @@ create_dialog (GeditSpellLanguageDialog *dlg,
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 6);
g_signal_connect (dlg,
"response",
@@ -167,13 +170,13 @@ create_dialog (GeditSpellLanguageDialog *dlg,
{
gtk_widget_show (error_widget);
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
error_widget);
return;
}
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
content, TRUE, TRUE, 0);
g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
diff --git a/plugins/time/gedit-time-plugin.c b/plugins/time/gedit-time-plugin.c
index 34e3d2a..b219208 100644
--- a/plugins/time/gedit-time-plugin.c
+++ b/plugins/time/gedit-time-plugin.c
@@ -773,9 +773,11 @@ get_configure_dialog (GeditTimePlugin *plugin)
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog->dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6);
g_return_val_if_fail (dialog->dialog != NULL, NULL);
@@ -799,7 +801,7 @@ get_configure_dialog (GeditTimePlugin *plugin)
if (!ret)
{
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),
+ gtk_box_pack_start_defaults (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
error_widget);
gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
@@ -852,7 +854,7 @@ get_configure_dialog (GeditTimePlugin *plugin)
/* setup a window of a sane size. */
gtk_widget_set_size_request (GTK_WIDGET (viewport), 10, 200);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
content, FALSE, FALSE, 0);
g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
@@ -934,7 +936,7 @@ get_choose_format_dialog (GtkWindow *parent,
GtkWindowGroup *wg = NULL;
if (parent != NULL)
- wg = parent->group;
+ wg = gtk_window_get_group (parent);
dialog = g_new0 (ChooseFormatDialog, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]