diff options
Diffstat (limited to 'src/dialogs/MultiTextEntryDialog.c')
-rw-r--r-- | src/dialogs/MultiTextEntryDialog.c | 286 |
1 files changed, 286 insertions, 0 deletions
diff --git a/src/dialogs/MultiTextEntryDialog.c b/src/dialogs/MultiTextEntryDialog.c new file mode 100644 index 0000000..7e682a6 --- /dev/null +++ b/src/dialogs/MultiTextEntryDialog.c @@ -0,0 +1,286 @@ +/* MultiTextEntryDialog.c generated by valac 0.36.6, the Vala compiler + * generated from MultiTextEntryDialog.vala, do not modify */ + +/* Copyright 2016 Software Freedom Conservancy Inc. + * Copyright 2017 Jens Georg <mail@jensge.org> + * + * This software is licensed under the GNU LGPL (version 2.1 or later). + * See the COPYING file in this distribution. + */ + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> +#include <stdlib.h> +#include <string.h> + + +#define TYPE_MULTI_TEXT_ENTRY_DIALOG (multi_text_entry_dialog_get_type ()) +#define MULTI_TEXT_ENTRY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_TEXT_ENTRY_DIALOG, MultiTextEntryDialog)) +#define MULTI_TEXT_ENTRY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_TEXT_ENTRY_DIALOG, MultiTextEntryDialogClass)) +#define IS_MULTI_TEXT_ENTRY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_TEXT_ENTRY_DIALOG)) +#define IS_MULTI_TEXT_ENTRY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_TEXT_ENTRY_DIALOG)) +#define MULTI_TEXT_ENTRY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_TEXT_ENTRY_DIALOG, MultiTextEntryDialogClass)) + +typedef struct _MultiTextEntryDialog MultiTextEntryDialog; +typedef struct _MultiTextEntryDialogClass MultiTextEntryDialogClass; +typedef struct _MultiTextEntryDialogPrivate MultiTextEntryDialogPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TYPE_PAGE_WINDOW (page_window_get_type ()) +#define PAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE_WINDOW, PageWindow)) +#define PAGE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE_WINDOW, PageWindowClass)) +#define IS_PAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE_WINDOW)) +#define IS_PAGE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE_WINDOW)) +#define PAGE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE_WINDOW, PageWindowClass)) + +typedef struct _PageWindow PageWindow; +typedef struct _PageWindowClass PageWindowClass; + +#define TYPE_APP_WINDOW (app_window_get_type ()) +#define APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APP_WINDOW, AppWindow)) +#define APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APP_WINDOW, AppWindowClass)) +#define IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APP_WINDOW)) +#define IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APP_WINDOW)) +#define APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APP_WINDOW, AppWindowClass)) + +typedef struct _AppWindow AppWindow; +typedef struct _AppWindowClass AppWindowClass; +#define _g_free0(var) (var = (g_free (var), NULL)) + +struct _MultiTextEntryDialog { + GtkDialog parent_instance; + MultiTextEntryDialogPrivate * priv; +}; + +struct _MultiTextEntryDialogClass { + GtkDialogClass parent_class; +}; + +typedef gboolean (*MultiTextEntryDialogOnModifyValidateType) (const gchar* text, void* user_data); +struct _MultiTextEntryDialogPrivate { + MultiTextEntryDialogOnModifyValidateType on_modify_validate; + gpointer on_modify_validate_target; + GtkTextView* entry; +}; + + +static gpointer multi_text_entry_dialog_parent_class = NULL; + +GType multi_text_entry_dialog_get_type (void) G_GNUC_CONST; +#define MULTI_TEXT_ENTRY_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MULTI_TEXT_ENTRY_DIALOG, MultiTextEntryDialogPrivate)) +enum { + MULTI_TEXT_ENTRY_DIALOG_DUMMY_PROPERTY +}; +MultiTextEntryDialog* multi_text_entry_dialog_new (void); +MultiTextEntryDialog* multi_text_entry_dialog_construct (GType object_type); +gint resources_use_header_bar (void); +void multi_text_entry_dialog_setup (MultiTextEntryDialog* self, MultiTextEntryDialogOnModifyValidateType modify_validate, void* modify_validate_target, const gchar* title, const gchar* label, const gchar* initial_text); +GType page_window_get_type (void) G_GNUC_CONST; +GType app_window_get_type (void) G_GNUC_CONST; +AppWindow* app_window_get_instance (void); +gchar* multi_text_entry_dialog_execute (MultiTextEntryDialog* self); +static void multi_text_entry_dialog_finalize (GObject * obj); + + +MultiTextEntryDialog* multi_text_entry_dialog_construct (GType object_type) { + MultiTextEntryDialog * self = NULL; + gint _tmp0_; +#line 17 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp0_ = resources_use_header_bar (); +#line 17 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + self = (MultiTextEntryDialog*) g_object_new (object_type, "use-header-bar", _tmp0_, NULL); +#line 16 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + return self; +#line 96 "MultiTextEntryDialog.c" +} + + +MultiTextEntryDialog* multi_text_entry_dialog_new (void) { +#line 16 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + return multi_text_entry_dialog_construct (TYPE_MULTI_TEXT_ENTRY_DIALOG); +#line 103 "MultiTextEntryDialog.c" +} + + +void multi_text_entry_dialog_setup (MultiTextEntryDialog* self, MultiTextEntryDialogOnModifyValidateType modify_validate, void* modify_validate_target, const gchar* title, const gchar* label, const gchar* initial_text) { + const gchar* _tmp0_; + AppWindow* _tmp1_; + AppWindow* _tmp2_; + GdkWindow* _tmp3_; + AppWindow* _tmp4_; + AppWindow* _tmp5_; + MultiTextEntryDialogOnModifyValidateType _tmp6_; + void* _tmp6__target; + const gchar* _tmp7_ = NULL; + const gchar* _tmp8_; + GtkTextView* _tmp10_; + GtkTextBuffer* _tmp11_; + GtkTextBuffer* _tmp12_; + GtkTextView* _tmp13_; +#line 20 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_return_if_fail (IS_MULTI_TEXT_ENTRY_DIALOG (self)); +#line 20 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_return_if_fail (title != NULL); +#line 20 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_return_if_fail (label != NULL); +#line 21 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp0_ = title; +#line 21 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_window_set_title (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), _tmp0_); +#line 22 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp1_ = app_window_get_instance (); +#line 22 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp2_ = _tmp1_; +#line 22 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp3_ = gtk_widget_get_parent_window (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget)); +#line 22 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_set_parent_window (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), _tmp3_); +#line 22 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _g_object_unref0 (_tmp2_); +#line 23 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp4_ = app_window_get_instance (); +#line 23 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp5_ = _tmp4_; +#line 23 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_window_set_transient_for (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_window_get_type (), GtkWindow)); +#line 23 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _g_object_unref0 (_tmp5_); +#line 24 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp6_ = modify_validate; +#line 24 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp6__target = modify_validate_target; +#line 24 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + self->priv->on_modify_validate = _tmp6_; +#line 24 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + self->priv->on_modify_validate_target = _tmp6__target; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp8_ = initial_text; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + if (_tmp8_ != NULL) { +#line 162 "MultiTextEntryDialog.c" + const gchar* _tmp9_; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp9_ = initial_text; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp7_ = _tmp9_; +#line 168 "MultiTextEntryDialog.c" + } else { +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp7_ = ""; +#line 172 "MultiTextEntryDialog.c" + } +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp10_ = self->priv->entry; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp11_ = gtk_text_view_get_buffer (_tmp10_); +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp12_ = _tmp11_; +#line 26 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_object_set (_tmp12_, "text", _tmp7_, NULL); +#line 28 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp13_ = self->priv->entry; +#line 28 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_grab_focus (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, gtk_widget_get_type (), GtkWidget)); +#line 186 "MultiTextEntryDialog.c" +} + + +gchar* multi_text_entry_dialog_execute (MultiTextEntryDialog* self) { + gchar* result = NULL; + gchar* text = NULL; + gint _tmp0_; +#line 31 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_return_val_if_fail (IS_MULTI_TEXT_ENTRY_DIALOG (self), NULL); +#line 32 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + text = NULL; +#line 34 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_show_all (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget)); +#line 36 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp0_ = gtk_dialog_run (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog)); +#line 36 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + if (_tmp0_ == ((gint) GTK_RESPONSE_OK)) { +#line 204 "MultiTextEntryDialog.c" + GtkTextView* _tmp1_; + GtkTextBuffer* _tmp2_; + GtkTextBuffer* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp1_ = self->priv->entry; +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp2_ = gtk_text_view_get_buffer (_tmp1_); +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp3_ = _tmp2_; +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_object_get (_tmp3_, "text", &_tmp4_, NULL); +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _tmp5_ = _tmp4_; +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _g_free0 (text); +#line 37 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + text = _tmp5_; +#line 224 "MultiTextEntryDialog.c" + } +#line 39 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_destroy (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget)); +#line 41 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + result = text; +#line 41 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + return result; +#line 232 "MultiTextEntryDialog.c" +} + + +static void multi_text_entry_dialog_class_init (MultiTextEntryDialogClass * klass) { + gint MultiTextEntryDialog_private_offset; +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + multi_text_entry_dialog_parent_class = g_type_class_peek_parent (klass); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + g_type_class_add_private (klass, sizeof (MultiTextEntryDialogPrivate)); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + G_OBJECT_CLASS (klass)->finalize = multi_text_entry_dialog_finalize; +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + MultiTextEntryDialog_private_offset = g_type_class_get_instance_private_offset (klass); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Shotwell/ui/multitextentrydialog.ui"); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "entry", FALSE, MultiTextEntryDialog_private_offset + G_STRUCT_OFFSET (MultiTextEntryDialogPrivate, entry)); +#line 250 "MultiTextEntryDialog.c" +} + + +static void multi_text_entry_dialog_instance_init (MultiTextEntryDialog * self) { +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + self->priv = MULTI_TEXT_ENTRY_DIALOG_GET_PRIVATE (self); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + gtk_widget_init_template (GTK_WIDGET (self)); +#line 259 "MultiTextEntryDialog.c" +} + + +static void multi_text_entry_dialog_finalize (GObject * obj) { + MultiTextEntryDialog * self; +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MULTI_TEXT_ENTRY_DIALOG, MultiTextEntryDialog); +#line 14 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + _g_object_unref0 (self->priv->entry); +#line 9 "/home/jens/Source/shotwell/src/dialogs/MultiTextEntryDialog.vala" + G_OBJECT_CLASS (multi_text_entry_dialog_parent_class)->finalize (obj); +#line 271 "MultiTextEntryDialog.c" +} + + +GType multi_text_entry_dialog_get_type (void) { + static volatile gsize multi_text_entry_dialog_type_id__volatile = 0; + if (g_once_init_enter (&multi_text_entry_dialog_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MultiTextEntryDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_text_entry_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiTextEntryDialog), 0, (GInstanceInitFunc) multi_text_entry_dialog_instance_init, NULL }; + GType multi_text_entry_dialog_type_id; + multi_text_entry_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "MultiTextEntryDialog", &g_define_type_info, 0); + g_once_init_leave (&multi_text_entry_dialog_type_id__volatile, multi_text_entry_dialog_type_id); + } + return multi_text_entry_dialog_type_id__volatile; +} + + + |