[bijiben/wip/sadiq/modernize: 6/6] import-dialog: wip
- From: Mohammed Sadiq <pksadiq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben/wip/sadiq/modernize: 6/6] import-dialog: wip
- Date: Thu, 23 Nov 2017 02:35:39 +0000 (UTC)
commit d8493a7e6f25c91e372cd8f469b508e073b0cd21
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Tue Nov 21 10:24:44 2017 +0530
import-dialog: wip
data/bjb.gresource.xml | 1 +
data/resources/import-dialog.ui | 249 +++++++++++++++++++++++++
src/bjb-import-dialog.c | 386 ++++++++-------------------------------
3 files changed, 331 insertions(+), 305 deletions(-)
---
diff --git a/data/bjb.gresource.xml b/data/bjb.gresource.xml
index df3f768..950cbb6 100644
--- a/data/bjb.gresource.xml
+++ b/data/bjb.gresource.xml
@@ -17,5 +17,6 @@
<gresource prefix="/org/gnome/bijiben/ui">
<file alias="settings-dialog.ui">resources/settings-dialog.ui</file>
<file alias="empty-results-box.ui">resources/empty-results-box.ui</file>
+ <file alias="import-dialog.ui" preprocess="xml-stripblanks">resources/import-dialog.ui</file>
</gresource>
</gresources>
diff --git a/data/resources/import-dialog.ui b/data/resources/import-dialog.ui
new file mode 100644
index 0000000..4362a25
--- /dev/null
+++ b/data/resources/import-dialog.ui
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="BjbImportDialog" parent="GtkDialog">
+ <property name="modal">1</property>
+ <property name="title" translatable="yes">Import Notes</property>
+ <property name="width-request">500</property>
+
+ <child type="action">
+ <object class="GtkButton" id="cancel_button">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use-underline">1</property>
+ <!-- <signal name="clicked" handler="close_dialog" swapped="yes"/> -->
+ </object>
+ </child>
+
+ <child type="action">
+ <object class="GtkButton" id="import_button">
+ <property name="visible">1</property>
+ <property name="sensitive">0</property>
+ <property name="can-default">1</property>
+ <property name="label" translatable="yes">_Import</property>
+ <property name="use-underline">1</property>
+ <!-- <signal name="clicked" handler="save_chef" swapped="yes"/> -->
+ </object>
+ </child>
+
+ <child internal-child="vbox">
+ <object class="GtkBox" id="action_area">
+ <property name="visible">1</property>
+ <property name="orientation">vertical</property>
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
+ <property name="border-width">2</property>
+ <property name="margin-start">12</property>
+ <property name="margin-top">12</property>
+
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="margin-bottom">0</property>
+ <property name="label" translatable="yes">Select import location</property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkFrame" id="frame">
+ <property name="visible">1</property>
+ <child>
+ <object class="GtkListBox" id="box">
+ <property name="visible">1</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="on_row_activated_cb" object="BjbImportDialog"
swapped="no"/>
+
+ <!-- Gnote Application -->
+ <child>
+ <object class="GtkBox" id="gnote_import">
+ <property name="visible">1</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="margin-start">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">folder-documents-symbolic</property>
+ <property name="pixel-size">24</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="gnote_label">
+ <property name="visible">1</property>
+ <property name="xalign">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Gnote application</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="gnote_stack">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="expand">1</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="opacity">0</property>
+ </object>
+ <packing>
+ <property name="name">empty</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">1</property>
+ <property name="icon-name">object-select-symbolic</property>
+ <property name="pixel-size">32</property>
+ </object>
+ <packing>
+ <property name="name">tick</property>
+ </packing>
+ </child>
+ </object>
+ </child> <!-- ./GtkStack gnote_stack -->
+ </object>
+ </child>
+
+ <!-- Tomboy Application -->
+ <child>
+ <object class="GtkBox" id="tomboy_import">
+ <property name="visible">1</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="margin-start">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">folder-documents-symbolic</property>
+ <property name="pixel-size">24</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="tomboy_label">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tomboy application</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="tomboy_stack">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="expand">1</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="opacity">0</property>
+ </object>
+ <packing>
+ <property name="name">empty</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">1</property>
+ <property name="icon-name">object-select-symbolic</property>
+ <property name="pixel-size">32</property>
+ </object>
+ <packing>
+ <property name="name">tick</property>
+ </packing>
+ </child>
+ </object>
+ </child> <!-- ./GtkStack tomboy_stack -->
+ </object>
+ </child>
+
+ <!-- Custom Directory -->
+ <child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="margin-start">12</property>
+ <property name="spacing">12</property>
+ <property name="name">custom</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">folder-visiting-symbolic</property>
+ <property name="pixel-size">24</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="custom_label">
+ <property name="visible">1</property>
+ <property name="sensitive">0</property>
+ <property name="halign">start</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Custom Location</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="custom_stack">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="expand">1</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="opacity">0</property>
+ </object>
+ <packing>
+ <property name="name">empty</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">object-select-symbolic</property>
+ <property name="pixel-size">32</property>
+ </object>
+ <packing>
+ <property name="name">tick</property>
+ </packing>
+ </child>
+ </object>
+ </child> <!-- ./GtkStack custom_stack -->
+ <child>
+ <object class="GtkFileChooserButton">
+ <property name="visible">1</property>
+ <property name="action">select-folder</property>
+ <signal name="current-folder-changed" handler="on_file_set_cb"
object="BjbImportDialog" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">1</property>
+ <property name="fill">0</property>
+ <property name="padding">6</property>
+ </packing>
+ </child>
+
+ </object>
+ </child>
+
+ <action-widgets>
+ <action-widget response="cancel">cancel_button</action-widget>
+ <action-widget response="ok" default="true">import_button</action-widget>
+ </action-widgets>
+ </template>
+
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="gnote_label"/>
+ <widget name="tomboy_label"/>
+ <widget name="custom_label"/>
+ </widgets>
+ </object>
+
+</interface>
diff --git a/src/bjb-import-dialog.c b/src/bjb-import-dialog.c
index cf5adde..b818c35 100644
--- a/src/bjb-import-dialog.c
+++ b/src/bjb-import-dialog.c
@@ -36,144 +36,74 @@
#define IMPORT_EMBLEM_WIDTH 32
#define IMPORT_EMBLEM_HEIGHT 32
-
-typedef struct
+typedef enum
{
- GtkWidget *overlay;
- GtkWidget *widget;
- GtkWidget *toggle;
-
- gboolean selected;
- gchar *location;
-
-} ImportDialogChild;
+ IMPORT_DIALOG_ITEM_TOMBOY = 1 << 0,
+ IMPORT_DIALOG_ITEM_GNOTE = 1 << 1,
+ IMPORT_DIALOG_ITEM_CUSTOM = 1 << 2,
+} ImportDialogItem;
struct _BjbImportDialog
{
- GtkDialog parent_instance;
+ GtkDialog parent_instance;
- GtkListBox *box;
+ GtkWidget *import_button;
+ GtkWidget *gnote_label;
+ GtkWidget *gnote_stack;
- /* Select spec. foder */
+ GtkWidget *tomboy_label;
+ GtkWidget *tomboy_stack;
- GtkWidget *cust_box;
- GtkWidget *browser;
- ImportDialogChild *custom;
+ GtkWidget *custom_label;
+ GtkWidget *custom_stack;
/* paths and Confirm button */
- GHashTable *locations;
- GtkWidget *go_go_go;
+ GHashTable *locations;
+ gchar *custom_location;
+
+ ImportDialogItem items;
};
G_DEFINE_TYPE (BjbImportDialog, bjb_import_dialog, GTK_TYPE_DIALOG)
-
-static ImportDialogChild *
-import_dialog_child_new (void)
-{
- ImportDialogChild *retval = g_slice_new (ImportDialogChild);
-
- retval->overlay = NULL;
- retval->widget = NULL;
- retval->toggle = NULL;
-
- retval->selected = FALSE;
- retval->location = NULL;
-
- return retval;
-}
-
-
static void
-import_dialog_child_free (ImportDialogChild *child)
+toggle_selection (BjbImportDialog *self,
+ GtkWidget *widget,
+ ImportDialogItem item)
{
- g_free (child->location);
- g_slice_free (ImportDialogChild, child);
-}
-
-static inline GQuark
-application_quark (void)
-{
- static GQuark quark;
-
- if (G_UNLIKELY (quark == 0))
- quark = g_quark_from_static_string ("bjb-application");
-
- return quark;
-}
-
+ if (item != IMPORT_DIALOG_ITEM_CUSTOM || self->custom_location)
+ self->items ^= item;
+ else
+ self->items &= item ^ IMPORT_DIALOG_ITEM_CUSTOM;
-static GtkWidget *
-child_toggle_new (void)
-{
- GtkWidget *w;
+ if (self->items & item)
+ gtk_stack_set_visible_child_name (GTK_STACK (widget), "tick");
+ else
+ gtk_stack_set_visible_child_name (GTK_STACK (widget), "empty");
- w = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_INVALID);
- gtk_image_set_pixel_size (GTK_IMAGE (w), 38);
- gtk_widget_show (w);
- return w;
+ if (self->items)
+ gtk_widget_set_sensitive (self->import_button, TRUE);
+ else
+ gtk_widget_set_sensitive (self->import_button, FALSE);
}
-
-/* row_activated
- * When an item is activated
- * Check for the location
- * Show or delete the visible toggle
- * Add or remove location from import paths */
-
static void
toggle_widget (BjbImportDialog *self,
- GObject *widget)
+ GtkWidget *widget)
{
- ImportDialogChild *child;
- GtkStyleContext *context;
- GList *keys;
-
- child = g_object_get_qdata (widget, application_quark ());
-
- if (!child->selected && child->location == NULL)
- return;
-
- child->selected = !child->selected;
-
-
- if (child->selected)
- {
- child->toggle = child_toggle_new ();
- gtk_overlay_add_overlay (GTK_OVERLAY (child->overlay), child->toggle);
-
- g_hash_table_add (self->locations, child->location);
- }
-
- else
- {
- if (child->toggle && GTK_IS_WIDGET (child->toggle))
- gtk_widget_destroy (child->toggle);
-
- g_hash_table_remove (self->locations, child->location);
- }
-
- context = gtk_widget_get_style_context (self->go_go_go);
- keys = g_hash_table_get_keys (self->locations);
+ const gchar *widget_name = gtk_widget_get_name (widget);
- if (keys)
- {
- gtk_style_context_add_class (context, "suggested-action");
- gtk_widget_set_sensitive (self->go_go_go, TRUE);
- g_list_free (keys);
- }
-
- else
- {
- gtk_widget_set_sensitive (self->go_go_go, FALSE);
- }
-
- gtk_widget_reset_style (self->go_go_go);
+ if (g_strcmp0 (widget_name, "custom") == 0)
+ toggle_selection (self, self->custom_stack, IMPORT_DIALOG_ITEM_CUSTOM);
+ else if (g_strcmp0 (widget_name, "gnote") == 0)
+ toggle_selection (self, self->gnote_stack, IMPORT_DIALOG_ITEM_GNOTE);
+ else if (g_strcmp0 (widget_name, "tomboy") == 0)
+ toggle_selection (self, self->tomboy_stack, IMPORT_DIALOG_ITEM_TOMBOY);
}
@@ -182,156 +112,30 @@ on_row_activated_cb (GtkListBox *list_box,
GtkListBoxRow *row,
gpointer user_data)
{
- toggle_widget (user_data, G_OBJECT (gtk_bin_get_child (GTK_BIN (row))));
-}
-
-
-static void
-header_func (GtkListBoxRow *row,
- GtkListBoxRow *before_row,
- gpointer user_data)
-{
- if (before_row != NULL && gtk_list_box_row_get_header (row) != NULL)
- gtk_list_box_row_set_header (row, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
-
- else
- gtk_list_box_row_set_header (row, NULL);
+ toggle_widget (user_data, gtk_bin_get_child (GTK_BIN (row)));
}
-
static void
-on_file_set_cb (GtkWidget *chooser,
- BjbImportDialog *dialog)
+on_file_set_cb (GtkWidget *chooser,
+ BjbImportDialog *self)
{
- gchar *location;
-
- /* Remove the former */
+ g_clear_pointer (&self->custom_location, g_free);
+ self->custom_location = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
- if (dialog->custom->location)
- {
- g_hash_table_remove (dialog->locations,
- dialog->custom->location);
- g_clear_pointer (&dialog->custom->location, g_free);
- }
+ toggle_selection (self, self->custom_stack, IMPORT_DIALOG_ITEM_CUSTOM);
-
- /* Handle the new : force toggle */
-
- location = dialog->custom->location =
- gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
-
- if (location)
- {
- gtk_widget_set_sensitive (dialog->cust_box, TRUE);
-
- dialog->custom->selected = FALSE;
- if (GTK_IS_WIDGET (dialog->custom->toggle))
- gtk_widget_destroy (dialog->custom->toggle);
-
- toggle_widget (dialog, G_OBJECT (dialog->custom->overlay));
- return;
- }
-
- gtk_widget_set_sensitive (dialog->cust_box, FALSE);
-}
-
-
-static ImportDialogChild *
-add_custom (BjbImportDialog *self)
-{
- GtkWidget *box, *w;
- ImportDialogChild *child;
-
- child = import_dialog_child_new ();
- child->widget = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_set_margin_top (child->widget, 6);
- gtk_widget_set_margin_bottom (child->widget, 6);
- child->overlay = gtk_overlay_new ();
- gtk_container_add (GTK_CONTAINER (child->overlay), child->widget);
-
- /* Left group */
- self->cust_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (box), self->cust_box, TRUE, FALSE, 0);
-
- w = gtk_image_new_from_icon_name ("folder-visiting-symbolic", GTK_ICON_SIZE_INVALID);
- gtk_image_set_pixel_size (GTK_IMAGE (w), 24);
- gtk_widget_set_margin_start (w, 12);
- gtk_widget_set_margin_end (w, 12);
- gtk_container_add (GTK_CONTAINER (self->cust_box), w);
-
-
- w = gtk_label_new (_("Custom Location"));
- gtk_widget_set_margin_end (w, 180);
- gtk_container_add (GTK_CONTAINER (self->cust_box), w);
- gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (self->cust_box), w, TRUE, FALSE, 0);
-
- gtk_widget_set_sensitive (self->cust_box, FALSE);
-
- /* Right group */
-
- self->browser =
- gtk_file_chooser_button_new ("", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (self->browser),
- g_get_user_data_dir ());
- gtk_box_pack_start (GTK_BOX (box), self->browser, TRUE, FALSE, 0);
-
- g_signal_connect (self->browser, "current-folder-changed",
- G_CALLBACK (on_file_set_cb), self);
-
- g_object_set_qdata_full (G_OBJECT (child->overlay), application_quark (),
- child, (GDestroyNotify) import_dialog_child_free);
-
- return child;
-}
-
-
-static ImportDialogChild *
-add_application (const gchar *app,
- const gchar *visible_label,
- gchar *location)
-{
- GtkWidget *box, *w;
- ImportDialogChild *child;
-
- child = import_dialog_child_new ();
- child->widget = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_set_margin_top (child->widget, 6);
- gtk_widget_set_margin_bottom (child->widget, 6);
- child->overlay = gtk_overlay_new ();
- child->location = location;
- gtk_container_add (GTK_CONTAINER (child->overlay), child->widget);
-
- if (location)
- g_object_set_qdata_full (G_OBJECT (child->overlay), application_quark (),
- child, (GDestroyNotify) import_dialog_child_free);
-
- w = gtk_image_new_from_icon_name ("folder-documents-symbolic", GTK_ICON_SIZE_INVALID);
- gtk_image_set_pixel_size (GTK_IMAGE (w), 24);
- gtk_widget_set_margin_start (w, 12);
- gtk_container_add (GTK_CONTAINER (box), w);
-
- w = gtk_label_new (visible_label);
- gtk_widget_set_margin_end (w, 180);
- gtk_container_add (GTK_CONTAINER (box), w);
- gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
- gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
-
- gtk_widget_show_all (box);
- return child;
+ if (self->custom_location)
+ gtk_widget_set_sensitive (self->custom_label, TRUE);
+ else
+ gtk_widget_set_sensitive (self->custom_label, FALSE);
}
-
static void
bjb_import_dialog_constructed (GObject *obj)
{
- GtkWidget *area, *label_box, *label, *frame;
gchar *path;
- GtkApplication *app;
ImportDialogChild *child;
BjbImportDialog *self = BJB_IMPORT_DIALOG (obj);
- GtkDialog *dialog = GTK_DIALOG (obj);
- GtkWindow *win = GTK_WINDOW (obj);
G_OBJECT_CLASS(bjb_import_dialog_parent_class)->constructed(obj);
@@ -340,72 +144,26 @@ bjb_import_dialog_constructed (GObject *obj)
self->locations = g_hash_table_new (g_str_hash, g_str_equal);
- app = GTK_APPLICATION (g_application_get_default ());
-
- gtk_window_set_transient_for (win, gtk_application_get_active_window (app));
- gtk_window_set_title (win, _("Import Notes"));
- gtk_window_set_modal (win, TRUE);
-
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR
- (gtk_dialog_get_header_bar (GTK_DIALOG (self))), TRUE);
-
-
- self->go_go_go = gtk_dialog_add_button (dialog, _("Import"), GTK_RESPONSE_OK);
- gtk_widget_set_sensitive (self->go_go_go, FALSE);
-
- /* Dialog Label */
- area = gtk_dialog_get_content_area (dialog);
- gtk_widget_set_margin_start (area, 12);
- gtk_container_set_border_width (GTK_CONTAINER (area), 2);
- gtk_widget_set_hexpand (area, TRUE);
- gtk_widget_set_vexpand (area, TRUE);
-
- label_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label = gtk_label_new (_("Select import location"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_box_pack_start (GTK_BOX (label_box), label, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (area), label_box, TRUE, FALSE, 12);
-
- /* Dialog locations to import */
-
- frame = gtk_frame_new (NULL);
- self->box = GTK_LIST_BOX (gtk_list_box_new ());
- gtk_list_box_set_selection_mode (self->box, GTK_SELECTION_NONE);
- gtk_list_box_set_activate_on_single_click (self->box, TRUE);
- gtk_list_box_set_header_func (self->box, (GtkListBoxUpdateHeaderFunc) header_func, NULL, NULL);
- g_signal_connect (self->box, "row-activated", G_CALLBACK (on_row_activated_cb), self);
- gtk_box_pack_start (GTK_BOX (area), GTK_WIDGET (frame) , TRUE, FALSE, 6);
-
- gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (self->box));
/*
* Tomboy and Gnote ~/.local/share are conditional.
* These are only packed if their data directories are present.
*/
- path = g_build_filename (g_get_user_data_dir (), "tomboy", NULL);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
- {
- child = add_application ("tomboy", _("Tomboy application"), path);
- gtk_container_add (GTK_CONTAINER (self->box), child->overlay);
- }
-
-
- path = g_build_filename (g_get_user_data_dir (), "gnote", NULL);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
- {
- child = add_application ("gnote", _("Gnote application"), path);
- gtk_container_add (GTK_CONTAINER (self->box), child->overlay);
- }
-
+ /* path = g_build_filename (g_get_user_data_dir (), "tomboy", NULL); */
+ /* if (g_file_test (path, G_FILE_TEST_EXISTS)) */
+ /* { */
+ /* child = add_application ("tomboy", _("Tomboy application"), path); */
+ /* gtk_container_add (GTK_CONTAINER (self->box), child->overlay); */
+ /* } */
- /* User decides path */
- child = self->custom = add_custom (self);
- gtk_container_add (GTK_CONTAINER (self->box), child->overlay);
-
-
- gtk_widget_show_all (GTK_WIDGET (self));
+ /* path = g_build_filename (g_get_user_data_dir (), "gnote", NULL); */
+ /* if (g_file_test (path, G_FILE_TEST_EXISTS)) */
+ /* { */
+ /* child = add_application ("gnote", _("Gnote application"), path); */
+ /* gtk_container_add (GTK_CONTAINER (self->box), child->overlay); */
+ /* } */
}
static void
@@ -422,23 +180,41 @@ static void
bjb_import_dialog_class_init (BjbImportDialogClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructed = bjb_import_dialog_constructed;
object_class->finalize = bjb_import_dialog_finalize;
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/bijiben/ui/import-dialog.ui");
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, import_button);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, gnote_label);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, gnote_stack);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, tomboy_label);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, tomboy_stack);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, custom_label);
+ gtk_widget_class_bind_template_child (widget_class, BjbImportDialog, custom_stack);
+
+ gtk_widget_class_bind_template_callback (widget_class, on_row_activated_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_file_set_cb);
}
static void
bjb_import_dialog_init (BjbImportDialog *self)
{
+ gtk_widget_init_template (GTK_WIDGET (self));
}
GtkDialog *
bjb_import_dialog_new (GtkApplication *bijiben)
{
+ GtkWindow *window;
+
+ window = gtk_application_get_active_window (bijiben);
return g_object_new (BJB_TYPE_IMPORT_DIALOG,
- "use-header-bar", TRUE,
+ "use-header-bar", TRUE,
+ "transient-for", window,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]