Start using GResource

This converts our existing ui files for the main programs to resources and adds
a template for xed-view-frame
This commit is contained in:
JosephMcc 2017-02-08 21:04:10 -08:00
parent 3cfd0f3d5f
commit e3e316ea8a
20 changed files with 626 additions and 685 deletions

View File

@ -182,6 +182,7 @@ GLIB_GSETTINGS
dnl ================================================================ dnl ================================================================
dnl Misc dnl Misc
dnl ================================================================ dnl ================================================================
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums) AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)

1
debian/rules vendored
View File

@ -7,6 +7,7 @@ DHFLAGS=--parallel
override_dh_install: override_dh_install:
rm -rfv debian/tmp/usr/lib/*/xed/plugins/*.la rm -rfv debian/tmp/usr/lib/*/xed/plugins/*.la
rm -rfv debian/tmp/usr/lib/*/xed/*.la
dh_install --fail-missing dh_install --fail-missing
override_dh_auto_configure: override_dh_auto_configure:

View File

@ -4,4 +4,3 @@ usr/share/glib-2.0
usr/share/help usr/share/help
usr/share/locale usr/share/locale
usr/share/xed/icons usr/share/xed/icons
usr/share/xed/ui/

1
debian/xed.install vendored
View File

@ -3,6 +3,7 @@ usr/lib/*/xed/girepository-1.0/
usr/lib/xed/xed-bugreport.sh usr/lib/xed/xed-bugreport.sh
usr/lib/*/xed/plugins/*.plugin usr/lib/*/xed/plugins/*.plugin
usr/lib/*/xed/plugins/*.so usr/lib/*/xed/plugins/*.so
usr/lib/*/xed/*.so
usr/share/applications/xed.desktop usr/share/applications/xed.desktop
usr/share/dbus-1/ usr/share/dbus-1/
usr/share/man/ usr/share/man/

View File

@ -2,7 +2,7 @@
bin_PROGRAMS = xed bin_PROGRAMS = xed
noinst_LTLIBRARIES = libxed.la pkglib_LTLIBRARIES = libxed.la
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_srcdir) \ -I$(top_srcdir) \
@ -24,7 +24,7 @@ xed_LDADD = \
xed_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*" xed_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
libxed_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*" libxed_la_LDFLAGS = -avoid-version -export-dynamic -no-undefined -export-symbols-regex "^[^_].*"
# XED_LIBS must be the last to ensure correct order on some platforms # XED_LIBS must be the last to ensure correct order on some platforms
libxed_la_LIBADD = $(XED_LIBS) libxed_la_LIBADD = $(XED_LIBS)
@ -87,10 +87,15 @@ headerdir = $(prefix)/include/xed
header_DATA = \ header_DATA = \
$(INST_H_FILES) $(INST_H_FILES)
BUILT_SOURCES_PRIVATE = \
xed-resources.c
libxed_c_files = \ libxed_c_files = \
xed-app.c \ xed-app.c \
xed-app-activatable.c \ xed-app-activatable.c \
xed-view-activatable.c \
xed-window-activatable.c \
xed-resources.c \
xed-close-button.c \ xed-close-button.c \
xed-close-confirmation-dialog.c \ xed-close-confirmation-dialog.c \
xed-commands-documents.c \ xed-commands-documents.c \
@ -127,10 +132,8 @@ libxed_c_files = \
xed-tab-label.c \ xed-tab-label.c \
xed-utils.c \ xed-utils.c \
xed-view.c \ xed-view.c \
xed-view-activatable.c \
xed-view-frame.c \ xed-view-frame.c \
xed-window.c \ xed-window.c
xed-window-activatable.c
libxed_la_SOURCES = \ libxed_la_SOURCES = \
$(BUILT_SOURCES) \ $(BUILT_SOURCES) \
@ -156,29 +159,28 @@ xed-marshal.c: xed-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) echo "#include \"xed-marshal.h\"" > $@ && \ $(AM_V_GEN) echo "#include \"xed-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=xed_marshal >> $@ $(GLIB_GENMARSHAL) $< --body --prefix=xed_marshal >> $@
uidir = $(datadir)/xed/ui/ xed-resources.c: resources/xed.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/resources --generate-dependencies $(srcdir)/resources/xed.gresource.xml)
ui_DATA = \ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/resources --generate-source $(srcdir)/resources/xed.gresource.xml
xed-ui.xml \
xed-searchbar.ui \
xed-print-preferences.ui \
xed-encodings-dialog.ui \
xed-preferences-dialog.ui
EXTRA_DIST = \ EXTRA_DIST = \
$(ui_DATA) \
xed-enum-types.h.template \ xed-enum-types.h.template \
xed-enum-types.c.template \ xed-enum-types.c.template \
xed-marshal.list \ xed-marshal.list \
xed.rc xed.rc \
resources/xed.gresource.xml \
resources/ui/xed-ui.xml \
resources/ui/xed-encodings-dialog.ui \
resources/ui/xed-preferences-dialog.ui \
resources/ui/xed-print-preferences.ui \
resources/ui/xed-searchbar.ui \
resources/ui/xed-view-frame.ui
CLEANFILES = $(BUILT_SOURCES) CLEANFILES = $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
if HAVE_INTROSPECTION if HAVE_INTROSPECTION
-include $(INTROSPECTION_MAKEFILE) -include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS = Xed-1.0.gir INTROSPECTION_GIRS = Xed-1.0.gir
Xed-1.0.gir: xed Xed-1.0.gir: xed
INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all
Xed_1_0_gir_NAMESPACE = Xed Xed_1_0_gir_NAMESPACE = Xed
@ -199,6 +201,6 @@ CLEANFILES += \
endif endif
dist-hook: dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES) cd $(distdir); rm -f $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="XedViewFrame" parent="GtkOverlay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_focus">False</property>
<property name="is_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">False</property>
<property name="is_focus">False</property>
<property name="shadow_type">none</property>
<child>
<object class="XedView" id="view">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="revealer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<child>
<object class="GtkFrame" id="frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="xed-goto-line-box"/>
</style>
<child>
<object class="GtkBox" id="hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkEntry" id="search_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">25</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/x/editor">
<file preprocess="xml-stripblanks">ui/xed-ui.xml</file>
<file preprocess="xml-stripblanks">ui/xed-encodings-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/xed-preferences-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/xed-print-preferences.ui</file>
<file preprocess="xml-stripblanks">ui/xed-searchbar.ui</file>
<file preprocess="xml-stripblanks">ui/xed-view-frame.ui</file>
</gresource>
</gresources>

View File

@ -322,14 +322,12 @@ init_liststore_available (XedEncodingsDialog *dialog)
static void static void
xed_encodings_dialog_init (XedEncodingsDialog *dlg) xed_encodings_dialog_init (XedEncodingsDialog *dlg)
{ {
GtkBuilder *builder;
GtkWidget *content; GtkWidget *content;
GtkCellRenderer *cell_renderer; GtkCellRenderer *cell_renderer;
GtkTreeModel *sort_model; GtkTreeModel *sort_model;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkWidget *error_widget;
gboolean ret;
gchar *file;
gchar *root_objects[] = { gchar *root_objects[] = {
"encodings-dialog-contents", "encodings-dialog-contents",
NULL NULL
@ -355,27 +353,16 @@ xed_encodings_dialog_init (XedEncodingsDialog *dlg)
g_signal_connect (dlg, "response", G_CALLBACK (response_handler), dlg); g_signal_connect (dlg, "response", G_CALLBACK (response_handler), dlg);
file = xed_dirs_get_ui_file ("xed-encodings-dialog.ui"); builder = gtk_builder_new ();
ret = xed_utils_get_ui_objects (file, gtk_builder_add_objects_from_resource (builder, "/org/x/editor/ui/xed-encodings-dialog.ui",
root_objects, root_objects, NULL);
&error_widget, content = GTK_WIDGET (gtk_builder_get_object (builder, "encodings-dialog-contents"));
"encodings-dialog-contents", &content, g_object_ref (content);
"add-button", &dlg->priv->add_button, dlg->priv->add_button = GTK_WIDGET (gtk_builder_get_object (builder, "add-button"));
"remove-button", &dlg->priv->remove_button, dlg->priv->remove_button = GTK_WIDGET (gtk_builder_get_object (builder, "remove-button"));
"available-treeview", &dlg->priv->available_treeview, dlg->priv->available_treeview = GTK_WIDGET (gtk_builder_get_object (builder, "available-treeview"));
"displayed-treeview", &dlg->priv->displayed_treeview, dlg->priv->displayed_treeview = GTK_WIDGET (gtk_builder_get_object (builder, "displayed-treeview"));
NULL); g_object_unref (builder);
g_free (file);
if (!ret)
{
gtk_widget_show (error_widget);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
return;
}
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), content, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), content, TRUE, TRUE, 0);
g_object_unref (content); g_object_unref (content);

View File

@ -1070,15 +1070,12 @@ setup_plugins_page (XedPreferencesDialog *dlg)
static void static void
xed_preferences_dialog_init (XedPreferencesDialog *dlg) xed_preferences_dialog_init (XedPreferencesDialog *dlg)
{ {
GtkWidget *error_widget; GtkBuilder *builder;
gboolean ret;
gchar *file;
gchar *root_objects[] = { gchar *root_objects[] = {
"notebook", "notebook",
"adjustment1", "adjustment1",
"adjustment2", "adjustment2",
"adjustment3", "adjustment3",
"install_scheme_image",
NULL NULL
}; };
@ -1106,52 +1103,35 @@ xed_preferences_dialog_init (XedPreferencesDialog *dlg)
g_signal_connect (dlg, "response", g_signal_connect (dlg, "response",
G_CALLBACK (dialog_response_handler), NULL); G_CALLBACK (dialog_response_handler), NULL);
file = xed_dirs_get_ui_file ("xed-preferences-dialog.ui"); builder = gtk_builder_new ();
ret = xed_utils_get_ui_objects (file, root_objects, &error_widget, gtk_builder_add_objects_from_resource (builder, "/org/x/editor/ui/xed-preferences-dialog.ui", root_objects, NULL);
"notebook", &dlg->priv->notebook, dlg->priv->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
g_object_ref (dlg->priv->notebook);
"display_line_numbers_checkbutton", &dlg->priv->display_line_numbers_checkbutton, dlg->priv->display_line_numbers_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "display_line_numbers_checkbutton"));
"highlight_current_line_checkbutton", &dlg->priv->highlight_current_line_checkbutton, dlg->priv->highlight_current_line_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "highlight_current_line_checkbutton"));
"bracket_matching_checkbutton", &dlg->priv->bracket_matching_checkbutton, dlg->priv->bracket_matching_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "bracket_matching_checkbutton"));
"wrap_text_checkbutton", &dlg->priv->wrap_text_checkbutton, dlg->priv->wrap_text_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "wrap_text_checkbutton"));
"split_checkbutton", &dlg->priv->split_checkbutton, dlg->priv->split_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "split_checkbutton"));
dlg->priv->right_margin_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "right_margin_checkbutton"));
"right_margin_checkbutton", &dlg->priv->right_margin_checkbutton, dlg->priv->right_margin_position_spinbutton = GTK_WIDGET (gtk_builder_get_object (builder, "right_margin_position_spinbutton"));
"right_margin_position_spinbutton", &dlg->priv->right_margin_position_spinbutton, dlg->priv->right_margin_position_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "right_margin_position_hbox"));
"right_margin_position_hbox", &dlg->priv->right_margin_position_hbox, dlg->priv->tabs_width_spinbutton = GTK_WIDGET (gtk_builder_get_object (builder, "tabs_width_spinbutton"));
dlg->priv->tabs_width_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "tabs_width_hbox"));
"tabs_width_spinbutton", &dlg->priv->tabs_width_spinbutton, dlg->priv->insert_spaces_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "insert_spaces_checkbutton"));
"tabs_width_hbox", &dlg->priv->tabs_width_hbox, dlg->priv->auto_indent_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "auto_indent_checkbutton"));
"insert_spaces_checkbutton", &dlg->priv->insert_spaces_checkbutton, dlg->priv->autosave_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "autosave_hbox"));
dlg->priv->backup_copy_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "backup_copy_checkbutton"));
"auto_indent_checkbutton", &dlg->priv->auto_indent_checkbutton, dlg->priv->auto_save_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "auto_save_checkbutton"));
dlg->priv->auto_save_spinbutton = GTK_WIDGET (gtk_builder_get_object (builder, "auto_save_spinbutton"));
"autosave_hbox", &dlg->priv->autosave_hbox, dlg->priv->tab_scrolling_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "tab_scrolling_checkbutton"));
"backup_copy_checkbutton", &dlg->priv->backup_copy_checkbutton, dlg->priv->default_font_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "default_font_checkbutton"));
"auto_save_checkbutton", &dlg->priv->auto_save_checkbutton, dlg->priv->font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
"auto_save_spinbutton", &dlg->priv->auto_save_spinbutton, dlg->priv->font_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "font_hbox"));
dlg->priv->schemes_treeview = GTK_WIDGET (gtk_builder_get_object (builder, "schemes_treeview"));
"tab_scrolling_checkbutton", &dlg->priv->tab_scrolling_checkbutton, dlg->priv->install_scheme_button = GTK_WIDGET (gtk_builder_get_object (builder, "install_scheme_button"));
dlg->priv->uninstall_scheme_button = GTK_WIDGET (gtk_builder_get_object (builder, "uninstall_scheme_button"));
"default_font_checkbutton", &dlg->priv->default_font_checkbutton, dlg->priv->plugin_manager_place_holder = GTK_WIDGET (gtk_builder_get_object (builder, "plugin_manager_place_holder"));
"font_button", &dlg->priv->font_button, g_object_unref (builder);
"font_hbox", &dlg->priv->font_hbox,
"schemes_treeview", &dlg->priv->schemes_treeview,
"install_scheme_button", &dlg->priv->install_scheme_button,
"uninstall_scheme_button", &dlg->priv->uninstall_scheme_button,
"plugin_manager_place_holder", &dlg->priv->plugin_manager_place_holder,
NULL);
g_free (file);
if (!ret)
{
gtk_widget_show (error_widget);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0);
return;
}
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), dlg->priv->notebook, FALSE, FALSE, 0); 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); g_object_unref (dlg->priv->notebook);

View File

@ -109,7 +109,8 @@ static guint print_job_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (XedPrintJob, xed_print_job, G_TYPE_OBJECT) G_DEFINE_TYPE (XedPrintJob, xed_print_job, G_TYPE_OBJECT)
static void static void
set_view (XedPrintJob *job, XedView *view) set_view (XedPrintJob *job,
XedView *view)
{ {
job->priv->view = view; job->priv->view = view;
job->priv->doc = XED_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); job->priv->doc = XED_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
@ -161,10 +162,14 @@ xed_print_job_finalize (GObject *object)
g_free (job->priv->status_string); g_free (job->priv->status_string);
if (job->priv->compositor != NULL) if (job->priv->compositor != NULL)
{
g_object_unref (job->priv->compositor); g_object_unref (job->priv->compositor);
}
if (job->priv->operation != NULL) if (job->priv->operation != NULL)
{
g_object_unref (job->priv->operation); g_object_unref (job->priv->operation);
}
G_OBJECT_CLASS (xed_print_job_parent_class)->finalize (object); G_OBJECT_CLASS (xed_print_job_parent_class)->finalize (object);
} }
@ -251,19 +256,13 @@ wrap_mode_checkbutton_toggled (GtkToggleButton *button,
{ {
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton))) if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton)))
{ {
gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, FALSE);
FALSE); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), TRUE);
gtk_toggle_button_set_inconsistent (
GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton),
TRUE);
} }
else else
{ {
gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, TRUE);
TRUE); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), FALSE);
gtk_toggle_button_set_inconsistent (
GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton),
FALSE);
} }
} }
@ -293,12 +292,10 @@ static GObject *
create_custom_widget_cb (GtkPrintOperation *operation, create_custom_widget_cb (GtkPrintOperation *operation,
XedPrintJob *job) XedPrintJob *job)
{ {
gboolean ret; GtkBuilder *builder;
GtkWidget *widget; GtkWidget *contents;
GtkWidget *error_widget;
guint line_numbers; guint line_numbers;
GtkWrapMode wrap_mode; GtkWrapMode wrap_mode;
gchar *file;
gboolean syntax_hl; gboolean syntax_hl;
gboolean print_header; gboolean print_header;
gchar *font_body, *font_header, *font_numbers; gchar *font_body, *font_header, *font_numbers;
@ -308,33 +305,26 @@ create_custom_widget_cb (GtkPrintOperation *operation,
NULL NULL
}; };
file = xed_dirs_get_ui_file ("xed-print-preferences.ui"); builder = gtk_builder_new ();
ret = xed_utils_get_ui_objects (file, gtk_builder_add_objects_from_resource (builder, "/org/x/editor/ui/xed-print-preferences.ui", root_objects, NULL);
root_objects, contents = GTK_WIDGET (gtk_builder_get_object (builder, "contents"));
&error_widget, g_object_ref (contents);
"contents", &widget, job->priv->syntax_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "syntax_checkbutton"));
"syntax_checkbutton", &job->priv->syntax_checkbutton, job->priv->line_numbers_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "line_numbers_checkbutton"));
"line_numbers_checkbutton", &job->priv->line_numbers_checkbutton, job->priv->line_numbers_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "line_numbers_hbox"));
"line_numbers_hbox", &job->priv->line_numbers_hbox, job->priv->line_numbers_spinbutton = GTK_WIDGET (gtk_builder_get_object (builder, "line_numbers_spinbutton"));
"line_numbers_spinbutton", &job->priv->line_numbers_spinbutton, job->priv->page_header_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "page_header_checkbutton"));
"page_header_checkbutton", &job->priv->page_header_checkbutton, job->priv->text_wrapping_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "text_wrapping_checkbutton"));
"text_wrapping_checkbutton", &job->priv->text_wrapping_checkbutton, job->priv->do_not_split_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "do_not_split_checkbutton"));
"do_not_split_checkbutton", &job->priv->do_not_split_checkbutton, job->priv->fonts_table = GTK_WIDGET (gtk_builder_get_object (builder, "fonts_table"));
"fonts_table", &job->priv->fonts_table, job->priv->body_font_label = GTK_WIDGET (gtk_builder_get_object (builder, "body_font_label"));
"body_font_label", &job->priv->body_font_label, job->priv->body_fontbutton = GTK_WIDGET (gtk_builder_get_object (builder, "body_fontbutton"));
"body_fontbutton", &job->priv->body_fontbutton, job->priv->headers_font_label = GTK_WIDGET (gtk_builder_get_object (builder, "headers_font_label"));
"headers_font_label", &job->priv->headers_font_label, job->priv->headers_fontbutton = GTK_WIDGET (gtk_builder_get_object (builder, "headers_fontbutton"));
"headers_fontbutton", &job->priv->headers_fontbutton, job->priv->numbers_font_label = GTK_WIDGET (gtk_builder_get_object (builder, "numbers_font_label"));
"numbers_font_label", &job->priv->numbers_font_label, job->priv->numbers_fontbutton = GTK_WIDGET (gtk_builder_get_object (builder, "numbers_fontbutton"));
"numbers_fontbutton", &job->priv->numbers_fontbutton, job->priv->restore_button = GTK_WIDGET (gtk_builder_get_object (builder, "restore_button"));
"restore_button", &job->priv->restore_button, g_object_unref (builder);
NULL);
g_free (file);
if (!ret)
{
return G_OBJECT (error_widget);
}
/* Get all settings values */ /* Get all settings values */
syntax_hl = g_settings_get_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING); syntax_hl = g_settings_get_boolean (job->priv->print_settings, XED_SETTINGS_PRINT_SYNTAX_HIGHLIGHTING);
@ -360,8 +350,7 @@ create_custom_widget_cb (GtkPrintOperation *operation,
} }
else else
{ {
gtk_spin_button_set_value (GTK_SPIN_BUTTON (job->priv->line_numbers_spinbutton), gtk_spin_button_set_value (GTK_SPIN_BUTTON (job->priv->line_numbers_spinbutton), 1);
1);
gtk_widget_set_sensitive (job->priv->line_numbers_hbox, FALSE); gtk_widget_set_sensitive (job->priv->line_numbers_hbox, FALSE);
} }
@ -371,22 +360,16 @@ create_custom_widget_cb (GtkPrintOperation *operation,
switch (wrap_mode) switch (wrap_mode)
{ {
case GTK_WRAP_WORD: case GTK_WRAP_WORD:
gtk_toggle_button_set_active ( gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), TRUE);
GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), TRUE);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), TRUE);
break; break;
case GTK_WRAP_CHAR: case GTK_WRAP_CHAR:
gtk_toggle_button_set_active ( gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), TRUE);
GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), FALSE);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), FALSE);
break; break;
default: default:
gtk_toggle_button_set_active ( gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), FALSE);
GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton), FALSE); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), TRUE);
gtk_toggle_button_set_inconsistent (
GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), TRUE);
} }
gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, wrap_mode != GTK_WRAP_NONE); gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, wrap_mode != GTK_WRAP_NONE);
@ -401,24 +384,16 @@ create_custom_widget_cb (GtkPrintOperation *operation,
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton), font_numbers); gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton), font_numbers);
g_free (font_numbers); g_free (font_numbers);
g_signal_connect (job->priv->line_numbers_checkbutton, g_signal_connect (job->priv->line_numbers_checkbutton, "toggled",
"toggled", G_CALLBACK (line_numbers_checkbutton_toggled), job);
G_CALLBACK (line_numbers_checkbutton_toggled), g_signal_connect (job->priv->text_wrapping_checkbutton, "toggled",
job); G_CALLBACK (wrap_mode_checkbutton_toggled), job);
g_signal_connect (job->priv->text_wrapping_checkbutton, g_signal_connect (job->priv->do_not_split_checkbutton, "toggled",
"toggled", G_CALLBACK (wrap_mode_checkbutton_toggled), job);
G_CALLBACK (wrap_mode_checkbutton_toggled), g_signal_connect (job->priv->restore_button, "clicked",
job); G_CALLBACK (restore_button_clicked), job);
g_signal_connect (job->priv->do_not_split_checkbutton,
"toggled",
G_CALLBACK (wrap_mode_checkbutton_toggled),
job);
g_signal_connect (job->priv->restore_button,
"clicked",
G_CALLBACK (restore_button_clicked),
job);
return G_OBJECT (widget); return G_OBJECT (contents);
} }
static void static void
@ -576,16 +551,12 @@ preview_cb (GtkPrintOperation *op,
{ {
job->priv->preview = xed_print_preview_new (op, gtk_preview, context); job->priv->preview = xed_print_preview_new (op, gtk_preview, context);
g_signal_connect_after (gtk_preview, g_signal_connect_after (gtk_preview, "ready",
"ready", G_CALLBACK (preview_ready), job);
G_CALLBACK (preview_ready),
job);
/* FIXME: should this go in the preview widget itself? */ /* FIXME: should this go in the preview widget itself? */
g_signal_connect (job->priv->preview, g_signal_connect (job->priv->preview, "destroy",
"destroy", G_CALLBACK (preview_destroyed), gtk_preview);
G_CALLBACK (preview_destroyed),
gtk_preview);
return TRUE; return TRUE;
} }
@ -614,7 +585,9 @@ paginate_cb (GtkPrintOperation *operation,
/* When previewing, the progress is just for pagination, when printing /* When previewing, the progress is just for pagination, when printing
* it's split between pagination and rendering */ * it's split between pagination and rendering */
if (!job->priv->is_preview) if (!job->priv->is_preview)
{
job->priv->progress /= 2.0; job->priv->progress /= 2.0;
}
g_signal_emit (job, print_job_signals[PRINTING], 0, job->priv->status); g_signal_emit (job, print_job_signals[PRINTING], 0, job->priv->status);
@ -639,9 +612,7 @@ draw_page_cb (GtkPrintOperation *operation,
job->priv->status = XED_PRINT_JOB_STATUS_DRAWING; job->priv->status = XED_PRINT_JOB_STATUS_DRAWING;
job->priv->status_string = g_strdup_printf ("Rendering page %d of %d...", job->priv->status_string = g_strdup_printf ("Rendering page %d of %d...", page_nr + 1, n_pages);
page_nr + 1,
n_pages);
job->priv->progress = page_nr / (2.0 * n_pages) + 0.5; job->priv->progress = page_nr / (2.0 * n_pages) + 0.5;
@ -721,12 +692,14 @@ xed_print_job_print (XedPrintJob *job,
job->priv->operation = gtk_print_operation_new (); job->priv->operation = gtk_print_operation_new ();
if (settings) if (settings)
gtk_print_operation_set_print_settings (priv->operation, {
settings); gtk_print_operation_set_print_settings (priv->operation, settings);
}
if (page_setup != NULL) if (page_setup != NULL)
gtk_print_operation_set_default_page_setup (priv->operation, {
page_setup); gtk_print_operation_set_default_page_setup (priv->operation, page_setup);
}
job_name = xed_document_get_short_name_for_display (priv->doc); job_name = xed_document_get_short_name_for_display (priv->doc);
gtk_print_operation_set_job_name (priv->operation, job_name); gtk_print_operation_set_job_name (priv->operation, job_name);
@ -734,48 +707,28 @@ xed_print_job_print (XedPrintJob *job,
gtk_print_operation_set_embed_page_setup (priv->operation, TRUE); gtk_print_operation_set_embed_page_setup (priv->operation, TRUE);
gtk_print_operation_set_custom_tab_label (priv->operation, gtk_print_operation_set_custom_tab_label (priv->operation, _("Text Editor"));
_("Text Editor"));
gtk_print_operation_set_allow_async (priv->operation, TRUE); gtk_print_operation_set_allow_async (priv->operation, TRUE);
g_signal_connect (priv->operation, g_signal_connect (priv->operation, "create-custom-widget",
"create-custom-widget", G_CALLBACK (create_custom_widget_cb), job);
G_CALLBACK (create_custom_widget_cb), g_signal_connect (priv->operation, "custom-widget-apply",
job); G_CALLBACK (custom_widget_apply_cb), job);
g_signal_connect (priv->operation, g_signal_connect (priv->operation, "begin-print",
"custom-widget-apply", G_CALLBACK (begin_print_cb), job);
G_CALLBACK (custom_widget_apply_cb), g_signal_connect (priv->operation, "preview",
job); G_CALLBACK (preview_cb), job);
g_signal_connect (priv->operation, g_signal_connect (priv->operation, "paginate",
"begin-print", G_CALLBACK (paginate_cb), job);
G_CALLBACK (begin_print_cb), g_signal_connect (priv->operation, "draw-page",
job); G_CALLBACK (draw_page_cb), job);
g_signal_connect (priv->operation, g_signal_connect (priv->operation, "end-print",
"preview", G_CALLBACK (end_print_cb), job);
G_CALLBACK (preview_cb), g_signal_connect (priv->operation, "done",
job); G_CALLBACK (done_cb), job);
g_signal_connect (priv->operation,
"paginate",
G_CALLBACK (paginate_cb),
job);
g_signal_connect (priv->operation,
"draw-page",
G_CALLBACK (draw_page_cb),
job);
g_signal_connect (priv->operation,
"end-print",
G_CALLBACK (end_print_cb),
job);
g_signal_connect (priv->operation,
"done",
G_CALLBACK (done_cb),
job);
return gtk_print_operation_run (priv->operation, return gtk_print_operation_run (priv->operation, action, parent, error);
action,
parent,
error);
} }
static void static void
@ -797,9 +750,7 @@ xed_print_job_new (XedView *view)
g_return_val_if_fail (XED_IS_VIEW (view), NULL); g_return_val_if_fail (XED_IS_VIEW (view), NULL);
job = XED_PRINT_JOB (g_object_new (XED_TYPE_PRINT_JOB, job = XED_PRINT_JOB (g_object_new (XED_TYPE_PRINT_JOB, "view", view, NULL));
"view", view,
NULL));
return job; return job;
} }

View File

@ -18,13 +18,6 @@
#define XED_SEARCHBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SEARCHBAR, XedSearchbarPrivate)) #define XED_SEARCHBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SEARCHBAR, XedSearchbarPrivate))
// typedef enum
// {
// SEARCH,
// REPLACE
// } SearchMode;
enum enum
{ {
SHOW_REPLACE, SHOW_REPLACE,
@ -666,35 +659,32 @@ xed_searchbar_init (XedSearchbar *searchbar)
{ {
GtkWidget *content; GtkWidget *content;
GtkSizeGroup *size_group; GtkSizeGroup *size_group;
GtkWidget *error_widget;
GtkStyleContext *context; GtkStyleContext *context;
GtkCssProvider *provider; GtkCssProvider *provider;
gchar *file; GtkBuilder *builder;
gchar *root_objects[] = { "searchbar_content", NULL }; gchar *root_objects[] = { "searchbar_content", NULL };
const gchar *data = ".button {padding: 0;}"; const gchar *data = ".button {padding: 0;}";
searchbar->priv = XED_SEARCHBAR_GET_PRIVATE (searchbar); searchbar->priv = XED_SEARCHBAR_GET_PRIVATE (searchbar);
file = xed_dirs_get_ui_file ("xed-searchbar.ui"); builder = gtk_builder_new ();
xed_utils_get_ui_objects (file, gtk_builder_add_objects_from_resource (builder, "/org/x/editor/ui/xed-searchbar.ui", root_objects, NULL);
root_objects, content = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar_content"));
&error_widget, g_object_ref (content);
"searchbar_content", &content, searchbar->priv->revealer = GTK_WIDGET (gtk_builder_get_object (builder, "revealer"));
"revealer", &searchbar->priv->revealer, searchbar->priv->grid = GTK_WIDGET (gtk_builder_get_object (builder, "grid"));
"grid", &searchbar->priv->grid, searchbar->priv->search_label = GTK_WIDGET (gtk_builder_get_object (builder, "search_label"));
"search_label", &searchbar->priv->search_label, searchbar->priv->replace_label = GTK_WIDGET (gtk_builder_get_object (builder, "replace_with_label"));
"replace_with_label", &searchbar->priv->replace_label, searchbar->priv->regex_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "regex_checkbutton"));
"regex_checkbutton", &searchbar->priv->regex_checkbutton, searchbar->priv->match_case_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "match_case_checkbutton"));
"match_case_checkbutton", &searchbar->priv->match_case_checkbutton, searchbar->priv->entire_word_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "entire_word_checkbutton"));
"entire_word_checkbutton", &searchbar->priv->entire_word_checkbutton, searchbar->priv->wrap_around_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "wrap_around_checkbutton"));
"wrap_around_checkbutton", &searchbar->priv->wrap_around_checkbutton, searchbar->priv->find_button = GTK_WIDGET (gtk_builder_get_object (builder, "find_button"));
"find_button", &searchbar->priv->find_button, searchbar->priv->find_prev_button = GTK_WIDGET (gtk_builder_get_object (builder, "find_prev_button"));
"find_prev_button", &searchbar->priv->find_prev_button, searchbar->priv->replace_button = GTK_WIDGET (gtk_builder_get_object (builder, "replace_button"));
"replace_button", &searchbar->priv->replace_button, searchbar->priv->replace_all_button = GTK_WIDGET (gtk_builder_get_object (builder, "replace_all_button"));
"replace_all_button", &searchbar->priv->replace_all_button, searchbar->priv->close_button = GTK_WIDGET (gtk_builder_get_object (builder, "close_button"));
"close_button", &searchbar->priv->close_button, g_object_unref (builder);
NULL);
g_free (file);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (searchbar)), "xed-searchbar"); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (searchbar)), "xed-searchbar");

View File

@ -37,12 +37,9 @@
#define SEARCH_POPUP_MARGIN 12 #define SEARCH_POPUP_MARGIN 12
#define XED_VIEW_FRAME_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_VIEW_FRAME, XedViewFramePrivate))
struct _XedViewFramePrivate struct _XedViewFramePrivate
{ {
GtkWidget *view; GtkWidget *view;
GtkWidget *overlay;
GtkTextMark *start_mark; GtkTextMark *start_mark;
@ -68,7 +65,7 @@ typedef enum
SEARCH_STATE_NOT_FOUND SEARCH_STATE_NOT_FOUND
} SearchState; } SearchState;
G_DEFINE_TYPE (XedViewFrame, xed_view_frame, GTK_TYPE_BOX) G_DEFINE_TYPE_WITH_PRIVATE (XedViewFrame, xed_view_frame, GTK_TYPE_OVERLAY)
static void static void
xed_view_frame_finalize (GObject *object) xed_view_frame_finalize (GObject *object)
@ -389,32 +386,18 @@ search_entry_populate_popup (GtkEntry *entry,
G_CALLBACK (search_enable_popdown), frame); G_CALLBACK (search_enable_popdown), frame);
} }
static GtkWidget * static void
create_search_widget (XedViewFrame *frame) setup_search_widget (XedViewFrame *frame)
{ {
GtkWidget *search_widget; g_signal_connect (frame->priv->revealer, "key-press-event",
GtkWidget *hbox;
GtkStyleContext *context;
/* wrap it in a frame, so we can specify borders etc */
search_widget = gtk_frame_new (NULL);
context = gtk_widget_get_style_context (search_widget);
gtk_style_context_add_class (context, "xed-goto-line-box");
gtk_widget_show (search_widget);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (search_widget), hbox);
gtk_widget_show (hbox);
g_signal_connect (hbox, "key-press-event",
G_CALLBACK (search_widget_key_press_event), frame); G_CALLBACK (search_widget_key_press_event), frame);
/* add entry */ /* add entry */
frame->priv->search_entry = gtk_entry_new (); // frame->priv->search_entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (frame->priv->search_entry, _("Line you want to move the cursor to")); // gtk_widget_set_tooltip_text (frame->priv->search_entry, _("Line you want to move the cursor to"));
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (frame->priv->search_entry), // gtk_entry_set_icon_from_icon_name (GTK_ENTRY (frame->priv->search_entry),
GTK_ENTRY_ICON_PRIMARY, "go-jump-symbolic"); // GTK_ENTRY_ICON_PRIMARY, "go-jump-symbolic");
gtk_widget_show (frame->priv->search_entry); // gtk_widget_show (frame->priv->search_entry);
g_signal_connect (frame->priv->search_entry, "activate", g_signal_connect (frame->priv->search_entry, "activate",
G_CALLBACK (search_entry_activate), frame); G_CALLBACK (search_entry_activate), frame);
@ -426,10 +409,6 @@ create_search_widget (XedViewFrame *frame)
G_CALLBACK (search_init), frame); G_CALLBACK (search_init), frame);
frame->priv->search_entry_focus_out_id = g_signal_connect (frame->priv->search_entry, "focus-out-event", frame->priv->search_entry_focus_out_id = g_signal_connect (frame->priv->search_entry, "focus-out-event",
G_CALLBACK (search_entry_focus_out_event), frame); G_CALLBACK (search_entry_focus_out_event), frame);
gtk_container_add (GTK_CONTAINER (hbox), frame->priv->search_entry);
return search_widget;
} }
static void static void
@ -496,6 +475,7 @@ static void
xed_view_frame_class_init (XedViewFrameClass *klass) xed_view_frame_class_init (XedViewFrameClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = xed_view_frame_finalize; object_class->finalize = xed_view_frame_finalize;
object_class->dispose = xed_view_frame_dispose; object_class->dispose = xed_view_frame_dispose;
@ -517,7 +497,10 @@ xed_view_frame_class_init (XedViewFrameClass *klass)
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
g_type_class_add_private (object_class, sizeof (XedViewFramePrivate)); gtk_widget_class_set_template_from_resource (widget_class, "/org/x/editor/ui/xed-view-frame.ui");
gtk_widget_class_bind_template_child_private (widget_class, XedViewFrame, view);
gtk_widget_class_bind_template_child_private (widget_class, XedViewFrame, revealer);
gtk_widget_class_bind_template_child_private (widget_class, XedViewFrame, search_entry);
} }
static GMountOperation * static GMountOperation *
@ -535,47 +518,23 @@ xed_view_frame_init (XedViewFrame *frame)
{ {
XedDocument *doc; XedDocument *doc;
GtkSourceFile *file; GtkSourceFile *file;
GtkWidget *sw;
GdkRGBA transparent = {0, 0, 0, 0}; GdkRGBA transparent = {0, 0, 0, 0};
frame->priv = XED_VIEW_FRAME_GET_PRIVATE (frame); frame->priv = xed_view_frame_get_instance_private (frame);
gtk_orientable_set_orientation (GTK_ORIENTABLE (frame), GTK_ORIENTATION_VERTICAL); gtk_widget_init_template (GTK_WIDGET (frame));
doc = xed_document_new (); gtk_widget_override_background_color (GTK_WIDGET (frame), 0, &transparent);
doc = xed_view_frame_get_document (frame);
file = xed_document_get_file (doc); file = xed_document_get_file (doc);
gtk_source_file_set_mount_operation_factory (file, view_frame_mount_operation_factory, frame, NULL); gtk_source_file_set_mount_operation_factory (file, view_frame_mount_operation_factory, frame, NULL);
frame->priv->view = xed_view_new (doc); setup_search_widget (frame);
gtk_widget_set_vexpand (frame->priv->view, TRUE);
gtk_widget_show (frame->priv->view);
g_object_unref (doc);
/* Create the scrolled window */
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), frame->priv->view);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (sw);
frame->priv->overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (frame->priv->overlay), sw);
gtk_widget_override_background_color (frame->priv->overlay, 0, &transparent);
gtk_widget_show (frame->priv->overlay);
gtk_box_pack_start (GTK_BOX (frame), frame->priv->overlay, TRUE, TRUE, 0);
/* Add revealer */
frame->priv->revealer = gtk_revealer_new ();
gtk_container_add (GTK_CONTAINER (frame->priv->revealer), create_search_widget (frame));
gtk_widget_show (frame->priv->revealer);
gtk_widget_set_halign (frame->priv->revealer, GTK_ALIGN_END);
gtk_widget_set_valign (frame->priv->revealer, GTK_ALIGN_START);
gtk_widget_set_margin_end (frame->priv->revealer, SEARCH_POPUP_MARGIN); gtk_widget_set_margin_end (frame->priv->revealer, SEARCH_POPUP_MARGIN);
gtk_widget_set_margin_start (frame->priv->revealer, SEARCH_POPUP_MARGIN); gtk_widget_set_margin_start (frame->priv->revealer, SEARCH_POPUP_MARGIN);
gtk_overlay_add_overlay (GTK_OVERLAY (frame->priv->overlay), frame->priv->revealer);
} }
XedViewFrame * XedViewFrame *

View File

@ -43,14 +43,14 @@ typedef struct _XedViewFramePrivate XedViewFramePrivate;
struct _XedViewFrame struct _XedViewFrame
{ {
GtkBox parent; GtkOverlay parent;
XedViewFramePrivate *priv; XedViewFramePrivate *priv;
}; };
struct _XedViewFrameClass struct _XedViewFrameClass
{ {
GtkBoxClass parent_class; GtkOverlayClass parent_class;
}; };
GType xed_view_frame_get_type (void) G_GNUC_CONST; GType xed_view_frame_get_type (void) G_GNUC_CONST;

View File

@ -528,6 +528,12 @@ xed_view_delete_from_cursor (GtkTextView *text_view,
} }
} }
static GtkTextBuffer *
xed_view_create_buffer (GtkTextView *text_view)
{
return GTK_TEXT_BUFFER (xed_document_new ());
}
static void static void
xed_view_class_init (XedViewClass *klass) xed_view_class_init (XedViewClass *klass)
{ {
@ -562,6 +568,7 @@ xed_view_class_init (XedViewClass *klass)
widget_class->realize = xed_view_realize; widget_class->realize = xed_view_realize;
text_view_class->delete_from_cursor = xed_view_delete_from_cursor; text_view_class->delete_from_cursor = xed_view_delete_from_cursor;
text_view_class->create_buffer = xed_view_create_buffer;
/* A new signal DROP_URIS has been added to allow plugins to intercept /* A new signal DROP_URIS has been added to allow plugins to intercept
* the default dnd behaviour of 'text/uri-list'. XedView now handles * the default dnd behaviour of 'text/uri-list'. XedView now handles

View File

@ -30,7 +30,6 @@
#include "xed-settings.h" #include "xed-settings.h"
#define LANGUAGE_NONE (const gchar *)"LangNone" #define LANGUAGE_NONE (const gchar *)"LangNone"
#define XED_UIFILE "xed-ui.xml"
#define TAB_WIDTH_DATA "XedWindowTabWidthData" #define TAB_WIDTH_DATA "XedWindowTabWidthData"
#define LANGUAGE_DATA "XedWindowLanguageData" #define LANGUAGE_DATA "XedWindowLanguageData"
@ -1263,15 +1262,12 @@ create_menu_bar_and_toolbar (XedWindow *window,
g_object_unref (action_group); g_object_unref (action_group);
window->priv->panes_action_group = action_group; window->priv->panes_action_group = action_group;
/* now load the UI definition */ gtk_ui_manager_add_ui_from_resource (manager, "/org/x/editor/ui/xed-ui.xml", &error);
ui_file = xed_dirs_get_ui_file (XED_UIFILE);
gtk_ui_manager_add_ui_from_file (manager, ui_file, &error);
if (error != NULL) if (error != NULL)
{ {
g_warning("Could not merge %s: %s", ui_file, error->message); g_warning ("Could not add ui definition: %s", error->message);
g_error_free (error); g_error_free (error);
} }
g_free (ui_file);
/* show tooltips in the statusbar */ /* show tooltips in the statusbar */
g_signal_connect(manager, "connect_proxy", G_CALLBACK (connect_proxy_cb), window); g_signal_connect(manager, "connect_proxy", G_CALLBACK (connect_proxy_cb), window);