[gedit] view-frame: use G_DECLARE macros
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] view-frame: use G_DECLARE macros
- Date: Wed, 6 May 2015 16:42:22 +0000 (UTC)
commit 1fae4458f68b22c0a27c8c8caa6e81933767b736
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed May 6 16:16:21 2015 +0200
view-frame: use G_DECLARE macros
gedit/gedit-view-frame.c | 455 +++++++++++++++++++++++-----------------------
gedit/gedit-view-frame.h | 27 +---
2 files changed, 228 insertions(+), 254 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 9d99e9a..77a8ed4 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -54,8 +54,10 @@ typedef enum
SEARCH_STATE_NOT_FOUND
} SearchState;
-struct _GeditViewFramePrivate
+struct _GeditViewFrame
{
+ GtkOverlay parent_instance;
+
GeditView *view;
GeditViewHolder *view_holder;
GtkWidget *window;
@@ -105,7 +107,7 @@ enum
PROP_VIEW
};
-G_DEFINE_TYPE_WITH_PRIVATE (GeditViewFrame, gedit_view_frame, GTK_TYPE_OVERLAY)
+G_DEFINE_TYPE (GeditViewFrame, gedit_view_frame, GTK_TYPE_OVERLAY)
static void
gedit_view_frame_dispose (GObject *object)
@@ -113,33 +115,33 @@ gedit_view_frame_dispose (GObject *object)
GeditViewFrame *frame = GEDIT_VIEW_FRAME (object);
GtkTextBuffer *buffer = NULL;
- if (frame->priv->view != NULL)
+ if (frame->view != NULL)
{
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
}
- if (frame->priv->start_mark != NULL && buffer != NULL)
+ if (frame->start_mark != NULL && buffer != NULL)
{
- gtk_text_buffer_delete_mark (buffer, frame->priv->start_mark);
- frame->priv->start_mark = NULL;
+ gtk_text_buffer_delete_mark (buffer, frame->start_mark);
+ frame->start_mark = NULL;
}
- if (frame->priv->flush_timeout_id != 0)
+ if (frame->flush_timeout_id != 0)
{
- g_source_remove (frame->priv->flush_timeout_id);
- frame->priv->flush_timeout_id = 0;
+ g_source_remove (frame->flush_timeout_id);
+ frame->flush_timeout_id = 0;
}
- if (frame->priv->idle_update_entry_tag_id != 0)
+ if (frame->idle_update_entry_tag_id != 0)
{
- g_source_remove (frame->priv->idle_update_entry_tag_id);
- frame->priv->idle_update_entry_tag_id = 0;
+ g_source_remove (frame->idle_update_entry_tag_id);
+ frame->idle_update_entry_tag_id = 0;
}
- if (frame->priv->remove_entry_tag_timeout_id != 0)
+ if (frame->remove_entry_tag_timeout_id != 0)
{
- g_source_remove (frame->priv->remove_entry_tag_timeout_id);
- frame->priv->remove_entry_tag_timeout_id = 0;
+ g_source_remove (frame->remove_entry_tag_timeout_id);
+ frame->remove_entry_tag_timeout_id = 0;
}
if (buffer != NULL)
@@ -148,9 +150,9 @@ gedit_view_frame_dispose (GObject *object)
gtk_source_file_set_mount_operation_factory (file, NULL, NULL, NULL);
}
- g_clear_object (&frame->priv->entry_tag);
- g_clear_object (&frame->priv->search_settings);
- g_clear_object (&frame->priv->old_search_settings);
+ g_clear_object (&frame->entry_tag);
+ g_clear_object (&frame->search_settings);
+ g_clear_object (&frame->old_search_settings);
G_OBJECT_CLASS (gedit_view_frame_parent_class)->dispose (object);
}
@@ -159,16 +161,15 @@ static void
gedit_view_frame_finalize (GObject *object)
{
GeditViewFrame *frame = GEDIT_VIEW_FRAME (object);
- GeditViewFramePrivate *priv = frame->priv;
- g_free (priv->search_text);
- g_free (priv->old_search_text);
+ g_free (frame->search_text);
+ g_free (frame->old_search_text);
- if (priv->window_state_changed_handler_id != 0)
+ if (frame->window_state_changed_handler_id != 0)
{
- g_signal_handler_disconnect (priv->window,
- priv->window_state_changed_handler_id);
- priv->window_state_changed_handler_id = 0;
+ g_signal_handler_disconnect (frame->window,
+ frame->window_state_changed_handler_id);
+ frame->window_state_changed_handler_id = 0;
}
G_OBJECT_CLASS (gedit_view_frame_parent_class)->finalize (object);
@@ -204,50 +205,50 @@ hide_search_widget (GeditViewFrame *frame,
{
GtkTextBuffer *buffer;
- if (!gtk_revealer_get_reveal_child (frame->priv->revealer))
+ if (!gtk_revealer_get_reveal_child (frame->revealer))
{
return;
}
- if (frame->priv->view_scroll_event_id != 0)
+ if (frame->view_scroll_event_id != 0)
{
- g_signal_handler_disconnect (frame->priv->view,
- frame->priv->view_scroll_event_id);
- frame->priv->view_scroll_event_id = 0;
+ g_signal_handler_disconnect (frame->view,
+ frame->view_scroll_event_id);
+ frame->view_scroll_event_id = 0;
}
- if (frame->priv->flush_timeout_id != 0)
+ if (frame->flush_timeout_id != 0)
{
- g_source_remove (frame->priv->flush_timeout_id);
- frame->priv->flush_timeout_id = 0;
+ g_source_remove (frame->flush_timeout_id);
+ frame->flush_timeout_id = 0;
}
- gtk_revealer_set_reveal_child (frame->priv->revealer, FALSE);
+ gtk_revealer_set_reveal_child (frame->revealer, FALSE);
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
- if (cancel && frame->priv->start_mark != NULL)
+ if (cancel && frame->start_mark != NULL)
{
GtkTextIter iter;
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
- frame->priv->start_mark);
+ frame->start_mark);
gtk_text_buffer_place_cursor (buffer, &iter);
- gedit_view_scroll_to_cursor (frame->priv->view);
+ gedit_view_scroll_to_cursor (frame->view);
}
- if (frame->priv->start_mark != NULL)
+ if (frame->start_mark != NULL)
{
- gtk_text_buffer_delete_mark (buffer, frame->priv->start_mark);
- frame->priv->start_mark = NULL;
+ gtk_text_buffer_delete_mark (buffer, frame->start_mark);
+ frame->start_mark = NULL;
}
}
static gboolean
search_entry_flush_timeout (GeditViewFrame *frame)
{
- frame->priv->flush_timeout_id = 0;
+ frame->flush_timeout_id = 0;
hide_search_widget (frame, FALSE);
return G_SOURCE_REMOVE;
@@ -256,12 +257,12 @@ search_entry_flush_timeout (GeditViewFrame *frame)
static void
renew_flush_timeout (GeditViewFrame *frame)
{
- if (frame->priv->flush_timeout_id != 0)
+ if (frame->flush_timeout_id != 0)
{
- g_source_remove (frame->priv->flush_timeout_id);
+ g_source_remove (frame->flush_timeout_id);
}
- frame->priv->flush_timeout_id =
+ frame->flush_timeout_id =
g_timeout_add_seconds (FLUSH_TIMEOUT_DURATION,
(GSourceFunc)search_entry_flush_timeout,
frame);
@@ -284,7 +285,7 @@ get_search_context (GeditViewFrame *frame)
search_settings = gtk_source_search_context_get_settings (search_context);
- if (search_settings == frame->priv->search_settings)
+ if (search_settings == frame->search_settings)
{
return search_context;
}
@@ -298,7 +299,7 @@ set_search_state (GeditViewFrame *frame,
{
GtkStyleContext *context;
- context = gtk_widget_get_style_context (GTK_WIDGET (frame->priv->search_entry));
+ context = gtk_widget_get_style_context (GTK_WIDGET (frame->search_entry));
if (state == SEARCH_STATE_NOT_FOUND)
{
@@ -314,11 +315,11 @@ static void
finish_search (GeditViewFrame *frame,
gboolean found)
{
- const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (frame->priv->search_entry));
+ const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (frame->search_entry));
if (found || (entry_text[0] == '\0'))
{
- gedit_view_scroll_to_cursor (frame->priv->view);
+ gedit_view_scroll_to_cursor (frame->view);
set_search_state (frame, SEARCH_STATE_NORMAL);
}
@@ -352,13 +353,13 @@ start_search_finished (GtkSourceSearchContext *search_context,
&match_start,
&match_end);
}
- else if (frame->priv->start_mark != NULL)
+ else if (frame->start_mark != NULL)
{
GtkTextIter start_at;
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (buffer),
&start_at,
- frame->priv->start_mark);
+ frame->start_mark);
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (buffer),
&start_at,
@@ -375,7 +376,7 @@ start_search (GeditViewFrame *frame)
GtkTextBuffer *buffer;
GtkSourceSearchContext *search_context;
- g_return_if_fail (frame->priv->search_mode == SEARCH);
+ g_return_if_fail (frame->search_mode == SEARCH);
search_context = get_search_context (frame);
@@ -384,11 +385,11 @@ start_search (GeditViewFrame *frame)
return;
}
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
gtk_text_buffer_get_iter_at_mark (buffer,
&start_at,
- frame->priv->start_mark);
+ frame->start_mark);
gtk_source_search_context_forward_async (search_context,
&start_at,
@@ -414,7 +415,7 @@ forward_search_finished (GtkSourceSearchContext *search_context,
if (found)
{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
gtk_text_buffer_select_range (buffer,
&match_start,
@@ -431,7 +432,7 @@ forward_search (GeditViewFrame *frame)
GtkTextBuffer *buffer;
GtkSourceSearchContext *search_context;
- g_return_if_fail (frame->priv->search_mode == SEARCH);
+ g_return_if_fail (frame->search_mode == SEARCH);
search_context = get_search_context (frame);
@@ -442,7 +443,7 @@ forward_search (GeditViewFrame *frame)
renew_flush_timeout (frame);
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
gtk_text_buffer_get_selection_bounds (buffer, NULL, &start_at);
@@ -488,7 +489,7 @@ backward_search (GeditViewFrame *frame)
GtkTextBuffer *buffer;
GtkSourceSearchContext *search_context;
- g_return_if_fail (frame->priv->search_mode == SEARCH);
+ g_return_if_fail (frame->search_mode == SEARCH);
search_context = get_search_context (frame);
@@ -499,7 +500,7 @@ backward_search (GeditViewFrame *frame)
renew_flush_timeout (frame);
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
gtk_text_buffer_get_selection_bounds (buffer, &start_at, NULL);
@@ -515,7 +516,7 @@ search_widget_scroll_event (GtkWidget *widget,
GdkEventScroll *event,
GeditViewFrame *frame)
{
- if (frame->priv->search_mode == GOTO_LINE)
+ if (frame->search_mode == GOTO_LINE)
{
return GDK_EVENT_PROPAGATE;
}
@@ -576,12 +577,12 @@ search_widget_key_press_event (GtkWidget *widget,
if (event->keyval == GDK_KEY_Tab)
{
hide_search_widget (frame, FALSE);
- gtk_widget_grab_focus (GTK_WIDGET (frame->priv->view));
+ gtk_widget_grab_focus (GTK_WIDGET (frame->view));
return GDK_EVENT_STOP;
}
- if (frame->priv->search_mode == GOTO_LINE)
+ if (frame->search_mode == GOTO_LINE)
{
return GDK_EVENT_PROPAGATE;
}
@@ -608,10 +609,10 @@ search_widget_key_press_event (GtkWidget *widget,
static gboolean
remove_entry_tag_timeout_cb (GeditViewFrame *frame)
{
- frame->priv->remove_entry_tag_timeout_id = 0;
+ frame->remove_entry_tag_timeout_id = 0;
- gd_tagged_entry_remove_tag (frame->priv->search_entry,
- frame->priv->entry_tag);
+ gd_tagged_entry_remove_tag (frame->search_entry,
+ frame->entry_tag);
return G_SOURCE_REMOVE;
}
@@ -627,10 +628,10 @@ update_entry_tag (GeditViewFrame *frame)
gint pos;
gchar *label;
- if (frame->priv->search_mode == GOTO_LINE)
+ if (frame->search_mode == GOTO_LINE)
{
- gd_tagged_entry_remove_tag (frame->priv->search_entry,
- frame->priv->entry_tag);
+ gd_tagged_entry_remove_tag (frame->search_entry,
+ frame->entry_tag);
return;
}
@@ -643,7 +644,7 @@ update_entry_tag (GeditViewFrame *frame)
count = gtk_source_search_context_get_occurrences_count (search_context);
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
gtk_text_buffer_get_selection_bounds (buffer, &select_start, &select_end);
pos = gtk_source_search_context_get_occurrence_position (search_context,
@@ -660,9 +661,9 @@ update_entry_tag (GeditViewFrame *frame)
* time.
*/
- if (frame->priv->remove_entry_tag_timeout_id == 0)
+ if (frame->remove_entry_tag_timeout_id == 0)
{
- frame->priv->remove_entry_tag_timeout_id =
+ frame->remove_entry_tag_timeout_id =
g_timeout_add (500,
(GSourceFunc)remove_entry_tag_timeout_cb,
frame);
@@ -673,15 +674,15 @@ update_entry_tag (GeditViewFrame *frame)
if (count == 0 || pos == 0)
{
- gd_tagged_entry_remove_tag (frame->priv->search_entry,
- frame->priv->entry_tag);
+ gd_tagged_entry_remove_tag (frame->search_entry,
+ frame->entry_tag);
return;
}
- if (frame->priv->remove_entry_tag_timeout_id != 0)
+ if (frame->remove_entry_tag_timeout_id != 0)
{
- g_source_remove (frame->priv->remove_entry_tag_timeout_id);
- frame->priv->remove_entry_tag_timeout_id = 0;
+ g_source_remove (frame->remove_entry_tag_timeout_id);
+ frame->remove_entry_tag_timeout_id = 0;
}
/* Translators: the first %d is the position of the current search
@@ -690,10 +691,10 @@ update_entry_tag (GeditViewFrame *frame)
*/
label = g_strdup_printf (_("%d of %d"), pos, count);
- gd_tagged_entry_tag_set_label (frame->priv->entry_tag, label);
+ gd_tagged_entry_tag_set_label (frame->entry_tag, label);
- gd_tagged_entry_add_tag (frame->priv->search_entry,
- frame->priv->entry_tag);
+ gd_tagged_entry_add_tag (frame->search_entry,
+ frame->entry_tag);
g_free (label);
}
@@ -701,7 +702,7 @@ update_entry_tag (GeditViewFrame *frame)
static gboolean
update_entry_tag_idle_cb (GeditViewFrame *frame)
{
- frame->priv->idle_update_entry_tag_id = 0;
+ frame->idle_update_entry_tag_id = 0;
update_entry_tag (frame);
@@ -711,31 +712,31 @@ update_entry_tag_idle_cb (GeditViewFrame *frame)
static void
install_update_entry_tag_idle (GeditViewFrame *frame)
{
- if (frame->priv->idle_update_entry_tag_id == 0)
+ if (frame->idle_update_entry_tag_id == 0)
{
- frame->priv->idle_update_entry_tag_id = g_idle_add ((GSourceFunc)update_entry_tag_idle_cb,
- frame);
+ frame->idle_update_entry_tag_id = g_idle_add ((GSourceFunc)update_entry_tag_idle_cb,
+ frame);
}
}
static void
update_search_text (GeditViewFrame *frame)
{
- const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (frame->priv->search_entry));
+ const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (frame->search_entry));
- g_free (frame->priv->search_text);
- frame->priv->search_text = g_strdup (entry_text);
+ g_free (frame->search_text);
+ frame->search_text = g_strdup (entry_text);
- if (gtk_source_search_settings_get_regex_enabled (frame->priv->search_settings))
+ if (gtk_source_search_settings_get_regex_enabled (frame->search_settings))
{
- gtk_source_search_settings_set_search_text (frame->priv->search_settings,
+ gtk_source_search_settings_set_search_text (frame->search_settings,
entry_text);
}
else
{
gchar *unescaped_entry_text = gtk_source_utils_unescape_search_text (entry_text);
- gtk_source_search_settings_set_search_text (frame->priv->search_settings,
+ gtk_source_search_settings_set_search_text (frame->search_settings,
unescaped_entry_text);
g_free (unescaped_entry_text);
@@ -746,7 +747,7 @@ static void
regex_toggled_cb (GtkCheckMenuItem *menu_item,
GeditViewFrame *frame)
{
- gtk_source_search_settings_set_regex_enabled (frame->priv->search_settings,
+ gtk_source_search_settings_set_regex_enabled (frame->search_settings,
gtk_check_menu_item_get_active (menu_item));
start_search (frame);
@@ -756,7 +757,7 @@ static void
at_word_boundaries_toggled_cb (GtkCheckMenuItem *menu_item,
GeditViewFrame *frame)
{
- gtk_source_search_settings_set_at_word_boundaries (frame->priv->search_settings,
+ gtk_source_search_settings_set_at_word_boundaries (frame->search_settings,
gtk_check_menu_item_get_active (menu_item));
start_search (frame);
@@ -766,7 +767,7 @@ static void
case_sensitive_toggled_cb (GtkCheckMenuItem *menu_item,
GeditViewFrame *frame)
{
- gtk_source_search_settings_set_case_sensitive (frame->priv->search_settings,
+ gtk_source_search_settings_set_case_sensitive (frame->search_settings,
gtk_check_menu_item_get_active (menu_item));
start_search (frame);
@@ -785,7 +786,7 @@ add_popup_menu_items (GeditViewFrame *frame,
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
- g_object_bind_property (frame->priv->search_settings, "wrap-around",
+ g_object_bind_property (frame->search_settings, "wrap-around",
menu_item, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -795,7 +796,7 @@ add_popup_menu_items (GeditViewFrame *frame,
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
- val = gtk_source_search_settings_get_regex_enabled (frame->priv->search_settings);
+ val = gtk_source_search_settings_get_regex_enabled (frame->search_settings);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), val);
g_signal_connect (menu_item,
@@ -809,7 +810,7 @@ add_popup_menu_items (GeditViewFrame *frame,
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
- val = gtk_source_search_settings_get_at_word_boundaries (frame->priv->search_settings);
+ val = gtk_source_search_settings_get_at_word_boundaries (frame->search_settings);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), val);
g_signal_connect (menu_item,
@@ -823,7 +824,7 @@ add_popup_menu_items (GeditViewFrame *frame,
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
- val = gtk_source_search_settings_get_case_sensitive (frame->priv->search_settings);
+ val = gtk_source_search_settings_get_case_sensitive (frame->search_settings);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), val);
g_signal_connect (menu_item,
@@ -837,22 +838,22 @@ popup_menu_hide_cb (GeditViewFrame *frame)
{
renew_flush_timeout (frame);
- g_signal_handler_unblock (frame->priv->search_entry,
- frame->priv->search_entry_focus_out_id);
+ g_signal_handler_unblock (frame->search_entry,
+ frame->search_entry_focus_out_id);
}
static void
setup_popup_menu (GeditViewFrame *frame,
GtkWidget *menu)
{
- if (frame->priv->flush_timeout_id != 0)
+ if (frame->flush_timeout_id != 0)
{
- g_source_remove (frame->priv->flush_timeout_id);
- frame->priv->flush_timeout_id = 0;
+ g_source_remove (frame->flush_timeout_id);
+ frame->flush_timeout_id = 0;
}
- g_signal_handler_block (frame->priv->search_entry,
- frame->priv->search_entry_focus_out_id);
+ g_signal_handler_block (frame->search_entry,
+ frame->search_entry_focus_out_id);
g_signal_connect_swapped (menu,
"hide",
@@ -866,26 +867,26 @@ search_entry_escaped (GtkSearchEntry *entry,
{
GtkSourceSearchContext *search_context = get_search_context (frame);
- if (frame->priv->search_mode == SEARCH &&
+ if (frame->search_mode == SEARCH &&
search_context != NULL)
{
- g_clear_object (&frame->priv->search_settings);
- frame->priv->search_settings = copy_search_settings (frame->priv->old_search_settings);
+ g_clear_object (&frame->search_settings);
+ frame->search_settings = copy_search_settings (frame->old_search_settings);
gtk_source_search_context_set_settings (search_context,
- frame->priv->search_settings);
+ frame->search_settings);
- g_free (frame->priv->search_text);
- frame->priv->search_text = NULL;
+ g_free (frame->search_text);
+ frame->search_text = NULL;
- if (frame->priv->old_search_text != NULL)
+ if (frame->old_search_text != NULL)
{
- frame->priv->search_text = g_strdup (frame->priv->old_search_text);
+ frame->search_text = g_strdup (frame->old_search_text);
}
}
hide_search_widget (frame, TRUE);
- gtk_widget_grab_focus (GTK_WIDGET (frame->priv->view));
+ gtk_widget_grab_focus (GTK_WIDGET (frame->view));
}
static void
@@ -909,7 +910,7 @@ search_entry_populate_popup (GtkEntry *entry,
{
GtkWidget *menu_item;
- if (frame->priv->search_mode == GOTO_LINE)
+ if (frame->search_mode == GOTO_LINE)
{
return;
}
@@ -932,7 +933,7 @@ search_entry_icon_release (GtkEntry *entry,
{
GtkWidget *menu;
- if (frame->priv->search_mode == GOTO_LINE ||
+ if (frame->search_mode == GOTO_LINE ||
icon_pos != GTK_ENTRY_ICON_PRIMARY)
{
return;
@@ -955,7 +956,7 @@ search_entry_activate (GtkEntry *entry,
GeditViewFrame *frame)
{
hide_search_widget (frame, FALSE);
- gtk_widget_grab_focus (GTK_WIDGET (frame->priv->view));
+ gtk_widget_grab_focus (GTK_WIDGET (frame->view));
}
static void
@@ -970,7 +971,7 @@ search_entry_insert_text (GtkEditable *editable,
const gchar *end;
const gchar *next;
- if (frame->priv->search_mode == SEARCH)
+ if (frame->search_mode == SEARCH)
{
return;
}
@@ -1014,7 +1015,7 @@ search_entry_insert_text (GtkEditable *editable,
if (!g_unichar_isdigit (c))
{
g_signal_stop_emission_by_name (editable, "insert_text");
- gtk_widget_error_bell (GTK_WIDGET (frame->priv->search_entry));
+ gtk_widget_error_bell (GTK_WIDGET (frame->search_entry));
break;
}
@@ -1028,17 +1029,17 @@ customize_for_search_mode (GeditViewFrame *frame)
GIcon *icon;
gint width_request;
- if (frame->priv->search_mode == SEARCH)
+ if (frame->search_mode == SEARCH)
{
icon = g_themed_icon_new_with_default_fallbacks ("edit-find-symbolic");
width_request = 260;
- gtk_widget_set_tooltip_text (GTK_WIDGET (frame->priv->search_entry),
+ gtk_widget_set_tooltip_text (GTK_WIDGET (frame->search_entry),
_("String you want to search for"));
- gtk_widget_show (frame->priv->go_up_button);
- gtk_widget_show (frame->priv->go_down_button);
+ gtk_widget_show (frame->go_up_button);
+ gtk_widget_show (frame->go_down_button);
}
else
{
@@ -1046,18 +1047,18 @@ customize_for_search_mode (GeditViewFrame *frame)
width_request = 160;
- gtk_widget_set_tooltip_text (GTK_WIDGET (frame->priv->search_entry),
+ gtk_widget_set_tooltip_text (GTK_WIDGET (frame->search_entry),
_("Line you want to move the cursor to"));
- gtk_widget_hide (frame->priv->go_up_button);
- gtk_widget_hide (frame->priv->go_down_button);
+ gtk_widget_hide (frame->go_up_button);
+ gtk_widget_hide (frame->go_down_button);
}
- gtk_entry_set_icon_from_gicon (GTK_ENTRY (frame->priv->search_entry),
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (frame->search_entry),
GTK_ENTRY_ICON_PRIMARY,
icon);
- gtk_widget_set_size_request (GTK_WIDGET (frame->priv->search_entry),
+ gtk_widget_set_size_request (GTK_WIDGET (frame->search_entry),
width_request,
-1);
@@ -1078,7 +1079,7 @@ update_goto_line (GeditViewFrame *frame)
GtkTextIter iter;
GeditDocument *doc;
- entry_text = gtk_entry_get_text (GTK_ENTRY (frame->priv->search_entry));
+ entry_text = gtk_entry_get_text (GTK_ENTRY (frame->search_entry));
if (entry_text[0] == '\0')
{
@@ -1089,7 +1090,7 @@ update_goto_line (GeditViewFrame *frame)
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc),
&iter,
- frame->priv->start_mark);
+ frame->start_mark);
split_text = g_strsplit (entry_text, ":", -1);
@@ -1139,7 +1140,7 @@ update_goto_line (GeditViewFrame *frame)
moved = gedit_document_goto_line (doc, line);
moved_offset = gedit_document_goto_line_offset (doc, line, line_offset);
- gedit_view_scroll_to_cursor (frame->priv->view);
+ gedit_view_scroll_to_cursor (frame->view);
if (!moved || !moved_offset)
{
@@ -1157,7 +1158,7 @@ search_entry_changed_cb (GtkEntry *entry,
{
renew_flush_timeout (frame);
- if (frame->priv->search_mode == SEARCH)
+ if (frame->search_mode == SEARCH)
{
update_search_text (frame);
start_search (frame);
@@ -1229,9 +1230,9 @@ get_selected_text (GtkTextBuffer *doc,
static void
init_search_entry (GeditViewFrame *frame)
{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
- if (frame->priv->search_mode == GOTO_LINE)
+ if (frame->search_mode == GOTO_LINE)
{
gint line;
gchar *line_str;
@@ -1239,15 +1240,15 @@ init_search_entry (GeditViewFrame *frame)
gtk_text_buffer_get_iter_at_mark (buffer,
&iter,
- frame->priv->start_mark);
+ frame->start_mark);
line = gtk_text_iter_get_line (&iter);
line_str = g_strdup_printf ("%d", line + 1);
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry), line_str);
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry), line_str);
- gtk_editable_select_region (GTK_EDITABLE (frame->priv->search_entry),
+ gtk_editable_select_region (GTK_EDITABLE (frame->search_entry),
0, -1);
g_free (line_str);
@@ -1260,21 +1261,21 @@ init_search_entry (GeditViewFrame *frame)
gint selection_len = 0;
GtkSourceSearchContext *search_context;
- if (frame->priv->search_settings == NULL)
+ if (frame->search_settings == NULL)
{
- frame->priv->search_settings = gtk_source_search_settings_new ();
- gtk_source_search_settings_set_wrap_around (frame->priv->search_settings, TRUE);
+ frame->search_settings = gtk_source_search_settings_new ();
+ gtk_source_search_settings_set_wrap_around (frame->search_settings, TRUE);
}
- g_clear_object (&frame->priv->old_search_settings);
- frame->priv->old_search_settings = copy_search_settings (frame->priv->search_settings);
+ g_clear_object (&frame->old_search_settings);
+ frame->old_search_settings = copy_search_settings (frame->search_settings);
- g_free (frame->priv->old_search_text);
- frame->priv->old_search_text = NULL;
+ g_free (frame->old_search_text);
+ frame->old_search_text = NULL;
- if (frame->priv->search_text != NULL)
+ if (frame->search_text != NULL)
{
- frame->priv->old_search_text = g_strdup (frame->priv->search_text);
+ frame->old_search_text = g_strdup (frame->search_text);
}
search_context = get_search_context (frame);
@@ -1282,7 +1283,7 @@ init_search_entry (GeditViewFrame *frame)
if (search_context == NULL)
{
search_context = gtk_source_search_context_new (GTK_SOURCE_BUFFER (buffer),
- frame->priv->search_settings);
+ frame->search_settings);
gedit_document_set_search_context (GEDIT_DOCUMENT (buffer),
search_context);
@@ -1303,7 +1304,7 @@ init_search_entry (GeditViewFrame *frame)
{
gchar *search_text_escaped;
- if (gtk_source_search_settings_get_regex_enabled (frame->priv->search_settings))
+ if (gtk_source_search_settings_get_regex_enabled (frame->search_settings))
{
search_text_escaped = g_regex_escape_string (search_text, -1);
}
@@ -1312,24 +1313,24 @@ init_search_entry (GeditViewFrame *frame)
search_text_escaped = gtk_source_utils_escape_search_text (search_text);
}
- if (g_strcmp0 (search_text_escaped, frame->priv->search_text) == 0)
+ if (g_strcmp0 (search_text_escaped, frame->search_text) == 0)
{
/* The search text is the same, no need to
* trigger the search again. We prefer to select
* the text in the search entry, so the user can
* easily search something else.
*/
- g_signal_handler_block (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_block (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry),
search_text_escaped);
- gtk_editable_select_region (GTK_EDITABLE (frame->priv->search_entry),
+ gtk_editable_select_region (GTK_EDITABLE (frame->search_entry),
0, -1);
- g_signal_handler_unblock (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_unblock (frame->search_entry,
+ frame->search_entry_changed_id);
}
else
{
@@ -1339,27 +1340,27 @@ init_search_entry (GeditViewFrame *frame)
* because the user wants to search for
* search_text_escaped, not for something else.
*/
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry),
search_text_escaped);
- gtk_editable_set_position (GTK_EDITABLE (frame->priv->search_entry), -1);
+ gtk_editable_set_position (GTK_EDITABLE (frame->search_entry), -1);
}
g_free (search_text_escaped);
}
- else if (frame->priv->search_text != NULL)
+ else if (frame->search_text != NULL)
{
- g_signal_handler_block (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_block (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
- frame->priv->search_text);
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry),
+ frame->search_text);
- gtk_editable_select_region (GTK_EDITABLE (frame->priv->search_entry),
+ gtk_editable_select_region (GTK_EDITABLE (frame->search_entry),
0, -1);
- g_signal_handler_unblock (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_unblock (frame->search_entry,
+ frame->search_entry_changed_id);
}
g_free (search_text);
@@ -1373,25 +1374,25 @@ start_interactive_search_real (GeditViewFrame *frame,
GtkTextBuffer *buffer;
GtkTextIter iter;
- if (gtk_revealer_get_reveal_child (frame->priv->revealer))
+ if (gtk_revealer_get_reveal_child (frame->revealer))
{
- if (frame->priv->search_mode != request_search_mode)
+ if (frame->search_mode != request_search_mode)
{
hide_search_widget (frame, TRUE);
}
else
{
- gtk_editable_select_region (GTK_EDITABLE (frame->priv->search_entry),
+ gtk_editable_select_region (GTK_EDITABLE (frame->search_entry),
0, -1);
return;
}
}
- frame->priv->search_mode = request_search_mode;
+ frame->search_mode = request_search_mode;
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
- if (frame->priv->search_mode == SEARCH)
+ if (frame->search_mode == SEARCH)
{
gtk_text_buffer_get_selection_bounds (buffer, &iter, NULL);
}
@@ -1401,35 +1402,35 @@ start_interactive_search_real (GeditViewFrame *frame,
gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
}
- if (frame->priv->start_mark != NULL)
+ if (frame->start_mark != NULL)
{
- gtk_text_buffer_delete_mark (buffer, frame->priv->start_mark);
+ gtk_text_buffer_delete_mark (buffer, frame->start_mark);
}
- frame->priv->start_mark = gtk_text_buffer_create_mark (buffer, NULL, &iter, FALSE);
+ frame->start_mark = gtk_text_buffer_create_mark (buffer, NULL, &iter, FALSE);
- gtk_revealer_set_reveal_child (frame->priv->revealer, TRUE);
+ gtk_revealer_set_reveal_child (frame->revealer, TRUE);
/* NOTE: we must be very careful here to not have any text before
focusing the entry because when the entry is focused the text is
selected, and gtk+ doesn't allow us to have more than one selection
active */
- g_signal_handler_block (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_block (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry), "");
- g_signal_handler_unblock (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_unblock (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_widget_grab_focus (GTK_WIDGET (frame->priv->search_entry));
+ gtk_widget_grab_focus (GTK_WIDGET (frame->search_entry));
customize_for_search_mode (frame);
init_search_entry (frame);
/* Manage the scroll also for the view */
- frame->priv->view_scroll_event_id =
- g_signal_connect (frame->priv->view, "scroll-event",
+ frame->view_scroll_event_id =
+ g_signal_connect (frame->view, "scroll-event",
G_CALLBACK (search_widget_scroll_event),
frame);
@@ -1467,12 +1468,12 @@ gedit_view_frame_class_init (GeditViewFrameClass *klass)
/* Bind class to template */
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/gedit/ui/gedit-view-frame.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, view);
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, view_holder);
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, revealer);
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, search_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, go_up_button);
- gtk_widget_class_bind_template_child_private (widget_class, GeditViewFrame, go_down_button);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, view);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, view_holder);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, revealer);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, search_entry);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, go_up_button);
+ gtk_widget_class_bind_template_child (widget_class, GeditViewFrame, go_down_button);
}
static GMountOperation *
@@ -1490,12 +1491,11 @@ on_window_state_changed (GtkWidget *widget,
GdkEventWindowState *event,
GeditViewFrame *frame)
{
- GeditViewFramePrivate *priv = frame->priv;
gboolean fullscreen_state;
fullscreen_state = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
- gedit_view_holder_set_centering (priv->view_holder, fullscreen_state);
+ gedit_view_holder_set_centering (frame->view_holder, fullscreen_state);
return FALSE;
}
@@ -1505,23 +1505,22 @@ on_toplevel_window_changed (GtkWidget *widget,
GtkWidget *previous_toplevel,
GeditViewFrame *frame)
{
- GeditViewFramePrivate *priv = frame->priv;
GeditWindow *gedit_window;
- if (priv->window_state_changed_handler_id != 0)
+ if (frame->window_state_changed_handler_id != 0)
{
- g_signal_handler_disconnect (priv->window,
- priv->window_state_changed_handler_id);
- priv->window_state_changed_handler_id = 0;
+ g_signal_handler_disconnect (frame->window,
+ frame->window_state_changed_handler_id);
+ frame->window_state_changed_handler_id = 0;
}
gedit_window = GEDIT_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (frame), GEDIT_TYPE_WINDOW));
if (gedit_window)
{
- priv->window = GTK_WIDGET (&gedit_window->window);
+ frame->window = GTK_WIDGET (&gedit_window->window);
- priv->window_state_changed_handler_id = g_signal_connect (priv->window,
+ frame->window_state_changed_handler_id = g_signal_connect (frame->window,
"window-state-event",
G_CALLBACK
(on_window_state_changed),
frame);
@@ -1537,8 +1536,6 @@ gedit_view_frame_init (GeditViewFrame *frame)
gedit_debug (DEBUG_WINDOW);
- frame->priv = gedit_view_frame_get_instance_private (frame);
-
gtk_widget_init_template (GTK_WIDGET (frame));
gtk_widget_override_background_color (GTK_WIDGET (frame), 0, &transparent);
@@ -1546,21 +1543,21 @@ gedit_view_frame_init (GeditViewFrame *frame)
doc = gedit_view_frame_get_document (frame);
file = gedit_document_get_file (doc);
- frame->priv->window_state_changed_handler_id = 0;
+ frame->window_state_changed_handler_id = 0;
gtk_source_file_set_mount_operation_factory (file,
view_frame_mount_operation_factory,
frame,
NULL);
- frame->priv->entry_tag = gd_tagged_entry_tag_new ("");
+ frame->entry_tag = gd_tagged_entry_tag_new ("");
- gd_tagged_entry_tag_set_style (frame->priv->entry_tag,
+ gd_tagged_entry_tag_set_style (frame->entry_tag,
"gedit-search-entry-occurrences-tag");
- gd_tagged_entry_tag_set_has_close_button (frame->priv->entry_tag, FALSE);
+ gd_tagged_entry_tag_set_has_close_button (frame->entry_tag, FALSE);
- gtk_widget_set_margin_end (GTK_WIDGET (frame->priv->revealer),
+ gtk_widget_set_margin_end (GTK_WIDGET (frame->revealer),
SEARCH_POPUP_MARGIN);
g_signal_connect (doc,
@@ -1568,69 +1565,69 @@ gedit_view_frame_init (GeditViewFrame *frame)
G_CALLBACK (mark_set_cb),
frame);
- g_signal_connect (frame->priv->revealer,
+ g_signal_connect (frame->revealer,
"key-press-event",
G_CALLBACK (search_widget_key_press_event),
frame);
- g_signal_connect (frame->priv->revealer,
+ g_signal_connect (frame->revealer,
"scroll-event",
G_CALLBACK (search_widget_scroll_event),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"populate-popup",
G_CALLBACK (search_entry_populate_popup),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"icon-release",
G_CALLBACK (search_entry_icon_release),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"activate",
G_CALLBACK (search_entry_activate),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"insert-text",
G_CALLBACK (search_entry_insert_text),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"stop-search",
G_CALLBACK (search_entry_escaped),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"next-match",
G_CALLBACK (search_entry_next_match),
frame);
- g_signal_connect (frame->priv->search_entry,
+ g_signal_connect (frame->search_entry,
"previous-match",
G_CALLBACK (search_entry_previous_match),
frame);
- frame->priv->search_entry_changed_id =
- g_signal_connect (frame->priv->search_entry,
- "changed",
+ frame->search_entry_changed_id =
+ g_signal_connect (frame->search_entry,
+ "changed",
G_CALLBACK (search_entry_changed_cb),
frame);
- frame->priv->search_entry_focus_out_id =
- g_signal_connect (frame->priv->search_entry,
+ frame->search_entry_focus_out_id =
+ g_signal_connect (frame->search_entry,
"focus-out-event",
G_CALLBACK (search_entry_focus_out_event),
frame);
- g_signal_connect_swapped (frame->priv->go_up_button,
+ g_signal_connect_swapped (frame->go_up_button,
"clicked",
G_CALLBACK (backward_search),
frame);
- g_signal_connect_swapped (frame->priv->go_down_button,
+ g_signal_connect_swapped (frame->go_down_button,
"clicked",
G_CALLBACK (forward_search),
frame);
@@ -1642,7 +1639,7 @@ gedit_view_frame_init (GeditViewFrame *frame)
}
GeditViewFrame *
-gedit_view_frame_new ()
+gedit_view_frame_new (void)
{
return g_object_new (GEDIT_TYPE_VIEW_FRAME, NULL);
}
@@ -1652,7 +1649,7 @@ gedit_view_frame_get_document (GeditViewFrame *frame)
{
g_return_val_if_fail (GEDIT_IS_VIEW_FRAME (frame), NULL);
- return GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view)));
+ return GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view)));
}
GeditView *
@@ -1660,7 +1657,7 @@ gedit_view_frame_get_view (GeditViewFrame *frame)
{
g_return_val_if_fail (GEDIT_IS_VIEW_FRAME (frame), NULL);
- return frame->priv->view;
+ return frame->view;
}
void
@@ -1684,13 +1681,13 @@ gedit_view_frame_clear_search (GeditViewFrame *frame)
{
g_return_if_fail (GEDIT_IS_VIEW_FRAME (frame));
- g_signal_handler_block (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_block (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (frame->search_entry), "");
- g_signal_handler_unblock (frame->priv->search_entry,
- frame->priv->search_entry_changed_id);
+ g_signal_handler_unblock (frame->search_entry,
+ frame->search_entry_changed_id);
- gtk_widget_grab_focus (GTK_WIDGET (frame->priv->view));
+ gtk_widget_grab_focus (GTK_WIDGET (frame->view));
}
diff --git a/gedit/gedit-view-frame.h b/gedit/gedit-view-frame.h
index 0ef07e4..81ca932 100644
--- a/gedit/gedit-view-frame.h
+++ b/gedit/gedit-view-frame.h
@@ -29,31 +29,8 @@
G_BEGIN_DECLS
-#define GEDIT_TYPE_VIEW_FRAME (gedit_view_frame_get_type ())
-#define GEDIT_VIEW_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_VIEW_FRAME,
GeditViewFrame))
-#define GEDIT_VIEW_FRAME_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_VIEW_FRAME,
GeditViewFrame const))
-#define GEDIT_VIEW_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_VIEW_FRAME,
GeditViewFrameClass))
-#define GEDIT_IS_VIEW_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_VIEW_FRAME))
-#define GEDIT_IS_VIEW_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_VIEW_FRAME))
-#define GEDIT_VIEW_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GEDIT_TYPE_VIEW_FRAME, GeditViewFrameClass))
-
-typedef struct _GeditViewFrame GeditViewFrame;
-typedef struct _GeditViewFramePrivate GeditViewFramePrivate;
-typedef struct _GeditViewFrameClass GeditViewFrameClass;
-
-struct _GeditViewFrame
-{
- GtkOverlay parent;
-
- GeditViewFramePrivate *priv;
-};
-
-struct _GeditViewFrameClass
-{
- GtkOverlayClass parent_class;
-};
-
-GType gedit_view_frame_get_type (void) G_GNUC_CONST;
+#define GEDIT_TYPE_VIEW_FRAME (gedit_view_frame_get_type ())
+G_DECLARE_FINAL_TYPE (GeditViewFrame, gedit_view_frame, GEDIT, VIEW_FRAME, GtkOverlay)
GeditViewFrame *gedit_view_frame_new (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]