/* TextEntry.c generated by valac 0.40.4, the Vala compiler * generated from TextEntry.vala, do not modify */ /* Copyright 2016 Software Freedom Conservancy Inc. * Copyright 2017 Jens Georg * * This software is licensed under the GNU LGPL (version 2.1 or later). * See the COPYING file in this distribution. */ #include #include #include #include #include #include #define TYPE_TEXT_ENTRY_DIALOG (text_entry_dialog_get_type ()) #define TEXT_ENTRY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEXT_ENTRY_DIALOG, TextEntryDialog)) #define TEXT_ENTRY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEXT_ENTRY_DIALOG, TextEntryDialogClass)) #define IS_TEXT_ENTRY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEXT_ENTRY_DIALOG)) #define IS_TEXT_ENTRY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEXT_ENTRY_DIALOG)) #define TEXT_ENTRY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEXT_ENTRY_DIALOG, TextEntryDialogClass)) typedef struct _TextEntryDialog TextEntryDialog; typedef struct _TextEntryDialogClass TextEntryDialogClass; typedef struct _TextEntryDialogPrivate TextEntryDialogPrivate; enum { TEXT_ENTRY_DIALOG_0_PROPERTY, TEXT_ENTRY_DIALOG_NUM_PROPERTIES }; static GParamSpec* text_entry_dialog_properties[TEXT_ENTRY_DIALOG_NUM_PROPERTIES]; #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 TYPE_ENTRY_MULTI_COMPLETION (entry_multi_completion_get_type ()) #define ENTRY_MULTI_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENTRY_MULTI_COMPLETION, EntryMultiCompletion)) #define ENTRY_MULTI_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENTRY_MULTI_COMPLETION, EntryMultiCompletionClass)) #define IS_ENTRY_MULTI_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENTRY_MULTI_COMPLETION)) #define IS_ENTRY_MULTI_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENTRY_MULTI_COMPLETION)) #define ENTRY_MULTI_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENTRY_MULTI_COMPLETION, EntryMultiCompletionClass)) typedef struct _EntryMultiCompletion EntryMultiCompletion; typedef struct _EntryMultiCompletionClass EntryMultiCompletionClass; #define _g_free0(var) (var = (g_free (var), NULL)) struct _TextEntryDialog { GtkDialog parent_instance; TextEntryDialogPrivate * priv; }; struct _TextEntryDialogClass { GtkDialogClass parent_class; }; typedef gboolean (*TextEntryDialogOnModifyValidateType) (const gchar* text, void* user_data); struct _TextEntryDialogPrivate { TextEntryDialogOnModifyValidateType on_modify_validate; gpointer on_modify_validate_target; GtkEntry* entry; GtkLabel* label; }; static gpointer text_entry_dialog_parent_class = NULL; GType text_entry_dialog_get_type (void) G_GNUC_CONST; #define TEXT_ENTRY_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEXT_ENTRY_DIALOG, TextEntryDialogPrivate)) TextEntryDialog* text_entry_dialog_new (void); TextEntryDialog* text_entry_dialog_construct (GType object_type); gint resources_use_header_bar (void); void text_entry_dialog_setup (TextEntryDialog* self, TextEntryDialogOnModifyValidateType modify_validate, void* modify_validate_target, const gchar* title, const gchar* label, const gchar* initial_text, GeeCollection* completion_list, const gchar* completion_delimiter); GType page_window_get_type (void) G_GNUC_CONST; GType app_window_get_type (void) G_GNUC_CONST; AppWindow* app_window_get_instance (void); void text_entry_dialog_on_entry_changed (TextEntryDialog* self); static void _text_entry_dialog_on_entry_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self); GType entry_multi_completion_get_type (void) G_GNUC_CONST; EntryMultiCompletion* entry_multi_completion_new (GeeCollection* completion_list, const gchar* delimiter); EntryMultiCompletion* entry_multi_completion_construct (GType object_type, GeeCollection* completion_list, const gchar* delimiter); gchar* text_entry_dialog_execute (TextEntryDialog* self); static void text_entry_dialog_finalize (GObject * obj); TextEntryDialog* text_entry_dialog_construct (GType object_type) { TextEntryDialog * self = NULL; #line 21 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" self = (TextEntryDialog*) g_object_new (object_type, "use-header-bar", resources_use_header_bar (), NULL); #line 20 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" return self; #line 126 "TextEntry.c" } TextEntryDialog* text_entry_dialog_new (void) { #line 20 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" return text_entry_dialog_construct (TYPE_TEXT_ENTRY_DIALOG); #line 135 "TextEntry.c" } static void _text_entry_dialog_on_entry_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) { #line 35 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" text_entry_dialog_on_entry_changed ((TextEntryDialog*) self); #line 145 "TextEntry.c" } void text_entry_dialog_setup (TextEntryDialog* self, TextEntryDialogOnModifyValidateType modify_validate, void* modify_validate_target, const gchar* title, const gchar* label, const gchar* initial_text, GeeCollection* completion_list, const gchar* completion_delimiter) { AppWindow* _tmp0_; AppWindow* _tmp1_; GdkWindow* _tmp2_; AppWindow* _tmp3_; AppWindow* _tmp4_; GtkLabel* _tmp5_; const gchar* _tmp6_ = NULL; GtkEntry* _tmp7_; GtkEntry* _tmp8_; GtkEntry* _tmp9_; #line 24 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_if_fail (IS_TEXT_ENTRY_DIALOG (self)); #line 24 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_if_fail (title != NULL); #line 24 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_if_fail (label != NULL); #line 24 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_if_fail ((completion_list == NULL) || GEE_IS_COLLECTION (completion_list)); #line 26 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_window_set_title (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), title); #line 27 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp0_ = app_window_get_instance (); #line 27 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp1_ = _tmp0_; #line 27 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp2_ = gtk_widget_get_parent_window (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_widget_get_type (), GtkWidget)); #line 27 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_set_parent_window (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), _tmp2_); #line 27 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_object_unref0 (_tmp1_); #line 28 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp3_ = app_window_get_instance (); #line 28 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp4_ = _tmp3_; #line 28 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_window_set_transient_for (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_window_get_type (), GtkWindow), G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_window_get_type (), GtkWindow)); #line 28 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_object_unref0 (_tmp4_); #line 29 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" self->priv->on_modify_validate = modify_validate; #line 29 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" self->priv->on_modify_validate_target = modify_validate_target; #line 31 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp5_ = self->priv->label; #line 31 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_label_set_text (_tmp5_, label); #line 33 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" if (initial_text != NULL) { #line 33 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp6_ = initial_text; #line 209 "TextEntry.c" } else { #line 33 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp6_ = ""; #line 213 "TextEntry.c" } #line 33 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp7_ = self->priv->entry; #line 33 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_entry_set_text (_tmp7_, _tmp6_); #line 34 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp8_ = self->priv->entry; #line 34 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_grab_focus (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_widget_get_type (), GtkWidget)); #line 35 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp9_ = self->priv->entry; #line 35 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, gtk_editable_get_type (), GtkEditable), "changed", (GCallback) _text_entry_dialog_on_entry_changed_gtk_editable_changed, self, 0); #line 37 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" if (completion_list != NULL) { #line 229 "TextEntry.c" EntryMultiCompletion* completion = NULL; EntryMultiCompletion* _tmp10_; GtkEntry* _tmp11_; EntryMultiCompletion* _tmp12_; #line 38 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp10_ = entry_multi_completion_new (completion_list, completion_delimiter); #line 38 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" completion = _tmp10_; #line 40 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp11_ = self->priv->entry; #line 40 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp12_ = completion; #line 40 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_entry_set_completion (_tmp11_, G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_entry_completion_get_type (), GtkEntryCompletion)); #line 37 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_object_unref0 (completion); #line 246 "TextEntry.c" } #line 43 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_dialog_set_default_response (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog), (gint) GTK_RESPONSE_OK); #line 250 "TextEntry.c" } gchar* text_entry_dialog_execute (TextEntryDialog* self) { gchar* result = NULL; gchar* text = NULL; TextEntryDialogOnModifyValidateType _tmp0_; void* _tmp0__target; GtkEntry* _tmp1_; const gchar* _tmp2_; GtkEntry* _tmp6_; guint _tmp7_; #line 46 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_val_if_fail (IS_TEXT_ENTRY_DIALOG (self), NULL); #line 47 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" text = NULL; #line 50 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp0_ = self->priv->on_modify_validate; #line 50 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp0__target = self->priv->on_modify_validate_target; #line 50 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp1_ = self->priv->entry; #line 50 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp2_ = gtk_entry_get_text (_tmp1_); #line 50 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_dialog_set_response_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog), (gint) GTK_RESPONSE_OK, _tmp0_ (_tmp2_, _tmp0__target)); #line 52 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_show_all (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget)); #line 54 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" if (gtk_dialog_run (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog)) == ((gint) GTK_RESPONSE_OK)) { #line 283 "TextEntry.c" GtkEntry* _tmp3_; const gchar* _tmp4_; gchar* _tmp5_; #line 55 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp3_ = self->priv->entry; #line 55 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp4_ = gtk_entry_get_text (_tmp3_); #line 55 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp5_ = g_strdup (_tmp4_); #line 55 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_free0 (text); #line 55 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" text = _tmp5_; #line 297 "TextEntry.c" } #line 57 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp6_ = self->priv->entry; #line 57 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_signal_parse_name ("changed", gtk_editable_get_type (), &_tmp7_, NULL, FALSE); #line 57 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_editable_get_type (), GtkEditable), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _text_entry_dialog_on_entry_changed_gtk_editable_changed, self); #line 58 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_destroy (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget)); #line 60 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" result = text; #line 60 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" return result; #line 311 "TextEntry.c" } void text_entry_dialog_on_entry_changed (TextEntryDialog* self) { TextEntryDialogOnModifyValidateType _tmp0_; void* _tmp0__target; GtkEntry* _tmp1_; const gchar* _tmp2_; #line 63 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_return_if_fail (IS_TEXT_ENTRY_DIALOG (self)); #line 64 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp0_ = self->priv->on_modify_validate; #line 64 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp0__target = self->priv->on_modify_validate_target; #line 64 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp1_ = self->priv->entry; #line 64 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _tmp2_ = gtk_entry_get_text (_tmp1_); #line 64 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_dialog_set_response_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog), (gint) GTK_RESPONSE_OK, _tmp0_ (_tmp2_, _tmp0__target)); #line 334 "TextEntry.c" } static void text_entry_dialog_class_init (TextEntryDialogClass * klass) { gint TextEntryDialog_private_offset; #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" text_entry_dialog_parent_class = g_type_class_peek_parent (klass); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" g_type_class_add_private (klass, sizeof (TextEntryDialogPrivate)); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" G_OBJECT_CLASS (klass)->finalize = text_entry_dialog_finalize; #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" TextEntryDialog_private_offset = g_type_class_get_instance_private_offset (klass); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Shotwell/ui/textentrydialog.ui"); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "entry", FALSE, TextEntryDialog_private_offset + G_STRUCT_OFFSET (TextEntryDialogPrivate, entry)); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "label", FALSE, TextEntryDialog_private_offset + G_STRUCT_OFFSET (TextEntryDialogPrivate, label)); #line 356 "TextEntry.c" } static void text_entry_dialog_instance_init (TextEntryDialog * self) { #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" self->priv = TEXT_ENTRY_DIALOG_GET_PRIVATE (self); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" gtk_widget_init_template (GTK_WIDGET (self)); #line 367 "TextEntry.c" } static void text_entry_dialog_finalize (GObject * obj) { TextEntryDialog * self; #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEXT_ENTRY_DIALOG, TextEntryDialog); #line 15 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_object_unref0 (self->priv->entry); #line 18 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" _g_object_unref0 (self->priv->label); #line 9 "/home/jens/Source/shotwell/src/dialogs/TextEntry.vala" G_OBJECT_CLASS (text_entry_dialog_parent_class)->finalize (obj); #line 383 "TextEntry.c" } GType text_entry_dialog_get_type (void) { static volatile gsize text_entry_dialog_type_id__volatile = 0; if (g_once_init_enter (&text_entry_dialog_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (TextEntryDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) text_entry_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TextEntryDialog), 0, (GInstanceInitFunc) text_entry_dialog_instance_init, NULL }; GType text_entry_dialog_type_id; text_entry_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "TextEntryDialog", &g_define_type_info, 0); g_once_init_leave (&text_entry_dialog_type_id__volatile, text_entry_dialog_type_id); } return text_entry_dialog_type_id__volatile; }