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:
parent
3cfd0f3d5f
commit
e3e316ea8a
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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/
|
|
||||||
|
|
|
@ -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/
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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");
|
||||||
|
|
||||||
|
|
|
@ -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 *
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -528,12 +528,18 @@ 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)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS(klass);
|
GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
|
||||||
GtkBindingSet *binding_set;
|
GtkBindingSet *binding_set;
|
||||||
|
|
||||||
object_class->dispose = xed_view_dispose;
|
object_class->dispose = xed_view_dispose;
|
||||||
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue