diff options
-rw-r--r-- | gtk/src/callbacks.c | 10 | ||||
-rw-r--r-- | gtk/src/ghbcellrenderertext.c | 4 | ||||
-rw-r--r-- | gtk/src/ghbcompat.h | 36 | ||||
-rw-r--r-- | gtk/src/presets.c | 14 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 2 | ||||
-rw-r--r-- | gtk/src/settings.c | 8 |
6 files changed, 25 insertions, 49 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 1c5ebae68..dcb4fc758 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1945,7 +1945,7 @@ ghb_update_destination_extension(signal_user_data_t *ud) busy = TRUE; extension = get_extension(ud, ud->settings); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "dest_file")); - filename = g_strdup(ghb_entry_get_text(entry)); + filename = g_strdup(ghb_editable_get_text(entry)); for (ii = 0; containers[ii] != NULL; ii++) { if (g_str_has_suffix(filename, containers[ii])) @@ -1981,7 +1981,7 @@ destination_select_title(GtkEntry *entry) const gchar *dest; gint start, end; - dest = ghb_entry_get_text(entry); + dest = ghb_editable_get_text(entry); for (end = strlen(dest)-1; end > 0; end--) { if (dest[end] == '.') @@ -2097,7 +2097,7 @@ destination_action_cb(GSimpleAction *action, GVariant *param, basename = g_path_get_basename(filename); dirname = g_path_get_dirname(filename); entry = (GtkEntry*)GHB_WIDGET(ud->builder, "dest_file"); - ghb_entry_set_text(entry, basename); + ghb_editable_set_text(entry, basename); dest_chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "dest_dir")); gtk_file_chooser_set_filename(dest_chooser, dirname); g_free (dirname); @@ -3183,7 +3183,7 @@ ptop_input_cb(GtkWidget *widget, gdouble *val, signal_user_data_t *ud) double ss = 0; int hh = 0, mm = 0; - text = ghb_entry_get_text(GTK_ENTRY(widget)); + text = ghb_editable_get_text(widget); result = sscanf(text, "%2d:%2d:%lf", &hh, &mm, &ss); if (result <= 0) return FALSE; @@ -3215,7 +3215,7 @@ ptop_output_cb(GtkWidget *widget, signal_user_data_t *ud) value = value - mm * 60; ss = value; text = g_strdup_printf ("%02d:%02d:%05.2f", hh, mm, ss); - ghb_entry_set_text(GTK_ENTRY(widget), text); + ghb_editable_set_text(widget, text); g_free (text); return TRUE; diff --git a/gtk/src/ghbcellrenderertext.c b/gtk/src/ghbcellrenderertext.c index 8df691cff..79fd93410 100644 --- a/gtk/src/ghbcellrenderertext.c +++ b/gtk/src/ghbcellrenderertext.c @@ -1845,7 +1845,7 @@ ghb_cell_renderer_text_editing_done (GtkCellEditable *entry, return; path = g_object_get_data (G_OBJECT (entry), GHB_CELL_RENDERER_TEXT_PATH); - new_text = ghb_entry_get_text (GTK_ENTRY (entry)); + new_text = ghb_editable_get_text(entry); g_signal_emit (data, text_cell_renderer_signals[EDITED], 0, path, new_text); } @@ -1949,7 +1949,7 @@ ghb_cell_renderer_text_start_editing (GtkCellRenderer *cell, NULL); if (priv->text) - ghb_entry_set_text (GTK_ENTRY (priv->entry), priv->text); + ghb_editable_set_text (priv->entry, priv->text); g_object_set_data_full (G_OBJECT (priv->entry), I_(GHB_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free); diff --git a/gtk/src/ghbcompat.h b/gtk/src/ghbcompat.h index 44ef7f4e0..0db9d27ea 100644 --- a/gtk/src/ghbcompat.h +++ b/gtk/src/ghbcompat.h @@ -307,39 +307,15 @@ static inline gboolean ghb_strv_contains(const char ** strv, const char * str) } #if GTK_CHECK_VERSION(3, 90, 0) -static inline const gchar * ghb_entry_get_text(GtkEntry * entry) -{ - GtkEntryBuffer * buf = gtk_entry_get_buffer(entry); - if (buf != NULL) - { - return gtk_entry_buffer_get_text(buf); - } - return NULL; -} -static inline void ghb_entry_set_text(GtkEntry * entry, const gchar * text) -{ - GtkEntryBuffer * buf = gtk_entry_get_buffer(entry); - if (buf == NULL) - { - buf = gtk_entry_buffer_new(text, -1); - gtk_entry_set_buffer(entry, buf); - } - else - { - return gtk_entry_buffer_set_text(buf, text, -1); - } -} +#define ghb_editable_get_text(e) gtk_editable_get_text(GTK_EDITABLE(e)) +#define ghb_editable_set_text(e,t) gtk_editable_set_text(GTK_EDITABLE(e), (t)) + #else -static inline const gchar * ghb_entry_get_text(GtkEntry * entry) -{ - return gtk_entry_get_text(entry); -} -static inline void ghb_entry_set_text(GtkEntry * entry, const gchar * text) -{ - return gtk_entry_set_text(entry, text); -} +#define ghb_editable_get_text(e) gtk_entry_get_text(GTK_ENTRY(e)) +#define ghb_editable_set_text(e,t) gtk_entry_set_text(GTK_ENTRY(e), (t)) + #endif #if GTK_CHECK_VERSION(3, 90, 0) diff --git a/gtk/src/presets.c b/gtk/src/presets.c index c35933334..74cff997f 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -2179,7 +2179,7 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, dialog = GHB_WIDGET(ud->builder, "preset_rename_dialog"); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetReName")); - ghb_entry_set_text(entry, name); + ghb_editable_set_text(entry, name); response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(dialog); @@ -2190,7 +2190,7 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, char * desc; // save the new name - name = ghb_entry_get_text(entry); + name = ghb_editable_get_text(entry); dict = hb_preset_get(path); if (dict != NULL) { @@ -2295,7 +2295,7 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as) dialog = GHB_WIDGET(ud->builder, "preset_save_dialog"); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName")); - ghb_entry_set_text(entry, name); + ghb_editable_set_text(entry, name); widget = GHB_WIDGET(ud->builder, "PresetName"); gtk_widget_set_sensitive(widget, as); @@ -2314,12 +2314,12 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as) gboolean def; // save the preset - name = ghb_entry_get_text(entry); + name = ghb_editable_get_text(entry); category = ghb_dict_get_string(ud->settings, "PresetCategory"); if (!strcmp(category, "new")) { entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetCategoryName")); - category = ghb_entry_get_text(entry); + category = ghb_editable_get_text(entry); } if (category == NULL || category[0] == 0) { @@ -2363,9 +2363,9 @@ preset_save_set_ok_sensitive(signal_user_data_t *ud) category = ghb_dict_get_string(ud->settings, "PresetCategory"); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName")); - name = ghb_entry_get_text(entry); + name = ghb_editable_get_text(entry); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetCategoryName")); - category_name = ghb_entry_get_text(entry); + category_name = ghb_editable_get_text(entry); sensitive = name[0] && (strcmp(category, "new") || category_name[0]); gtk_widget_set_sensitive(ok_button, sensitive); diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 8d522075d..80549c014 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -2830,7 +2830,7 @@ queue_add_all_action_cb(GSimpleAction *action, GVariant *param, dest_dir = ghb_dict_get_string(settings, "dest_dir"); gtk_label_set_markup(label, title_label); - ghb_entry_set_text(entry, dest_file); + ghb_editable_set_text(entry, dest_file); gtk_file_chooser_set_filename(chooser, dest_dir); g_free(title_label); diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 7dad5f7e8..b95b85301 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -102,7 +102,7 @@ ghb_widget_value(GtkWidget *widget) name = ghb_get_setting_key(widget); if (type == GTK_TYPE_ENTRY) { - const gchar *str = ghb_entry_get_text(GTK_ENTRY(widget)); + const gchar *str = ghb_editable_get_text(widget); value = ghb_string_value_new(str); } else if (type == GTK_TYPE_RADIO_BUTTON) @@ -161,7 +161,7 @@ ghb_widget_value(GtkWidget *widget) else if (gtk_combo_box_get_has_entry(GTK_COMBO_BOX(widget))) { const gchar *str; - str = ghb_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget)))); + str = ghb_editable_get_text(gtk_bin_get_child(GTK_BIN(widget))); if (str == NULL) str = ""; value = ghb_string_value_new(str); } @@ -343,7 +343,7 @@ ghb_update_widget(GtkWidget *widget, const GhbValue *value) if (type == GTK_TYPE_ENTRY) { - ghb_entry_set_text((GtkEntry*)widget, str); + ghb_editable_set_text(widget, str); } else if (type == GTK_TYPE_RADIO_BUTTON) { @@ -412,7 +412,7 @@ ghb_update_widget(GtkWidget *widget, const GhbValue *value) GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget))); if (entry) { - ghb_entry_set_text (entry, str); + ghb_editable_set_text(entry, str); } else { |