summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c93
-rw-r--r--gtk/src/ghb.m4205
-rw-r--r--gtk/src/internal_defaults.json4
-rw-r--r--gtk/src/presets.c17
4 files changed, 256 insertions, 63 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 649e7d227..5ac796680 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -4083,6 +4083,15 @@ show_activity_menu_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
}
G_MODULE_EXPORT gboolean
+presets_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
+{
+ gtk_widget_set_visible(xwidget, FALSE);
+ GtkWidget *widget = GHB_WIDGET(ud->builder, "show_presets");
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), FALSE);
+ return TRUE;
+}
+
+G_MODULE_EXPORT gboolean
activity_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud)
{
gtk_widget_set_visible(xwidget, FALSE);
@@ -4250,25 +4259,47 @@ show_queue_menu_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
gtk_toggle_tool_button_set_active(button, active);
}
-G_MODULE_EXPORT void
-show_presets_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+static void
+presets_window_set_visible(signal_user_data_t *ud, gboolean visible)
{
- GtkWidget *frame;
- GtkWindow *hb_window;
+ GtkWidget * presets_window;
+ GtkWidget * hb_window;
+ int x, y;
- g_debug("show_presets_clicked_cb ()");
- frame = GHB_WIDGET (ud->builder, "presets_frame");
- ghb_widget_to_setting(ud->prefs, widget);
- if (ghb_dict_get_bool(ud->prefs, "show_presets"))
+ hb_window = GHB_WIDGET(ud->builder, "hb_window");
+ if (!gtk_widget_is_visible(hb_window))
{
- gtk_widget_show_now(frame);
+ return;
}
- else
+
+ presets_window = GHB_WIDGET(ud->builder, "presets_window");
+ gtk_widget_set_visible(presets_window, visible);
+ if (visible)
{
- gtk_widget_hide(frame);
- hb_window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window"));
- gtk_window_resize(hb_window, 16, 16);
+ int w, h;
+ w = ghb_dict_get_int(ud->prefs, "presets_window_width");
+ h = ghb_dict_get_int(ud->prefs, "presets_window_height");
+ if (w > 200 && h > 200)
+ {
+ gtk_window_resize(GTK_WINDOW(presets_window), w, h);
+ }
+ gtk_window_get_position(GTK_WINDOW(hb_window), &x, &y);
+ x -= w + 10;
+ if (x < 0)
+ {
+ gtk_window_move(GTK_WINDOW(hb_window), w + 10, y);
+ x = 0;
+ }
+ gtk_window_move(GTK_WINDOW(presets_window), x, y);
}
+}
+
+G_MODULE_EXPORT void
+show_presets_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ ghb_widget_to_setting(ud->prefs, widget);
+ presets_window_set_visible(ud, ghb_dict_get_bool(ud->prefs,
+ "show_presets"));
ghb_pref_save(ud->prefs, "show_presets");
}
@@ -5783,12 +5814,46 @@ ghb_notify_done(signal_user_data_t *ud)
}
G_MODULE_EXPORT gboolean
+window_map_cb(
+ GtkWidget *widget,
+ GdkEventAny *event,
+ signal_user_data_t *ud)
+{
+ presets_window_set_visible(ud, ghb_dict_get_bool(ud->prefs,
+ "show_presets"));
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+presets_window_configure_cb(
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
+{
+ if (gtk_widget_get_visible(widget))
+ {
+ gint w, h;
+ w = ghb_dict_get_int(ud->prefs, "presets_window_width");
+ h = ghb_dict_get_int(ud->prefs, "presets_window_height");
+
+ if ( w != event->width || h != event->height )
+ {
+ ghb_dict_set_int(ud->prefs, "presets_window_width", event->width);
+ ghb_dict_set_int(ud->prefs, "presets_window_height", event->height);
+ ghb_pref_set(ud->prefs, "presets_window_width");
+ ghb_pref_set(ud->prefs, "presets_window_height");
+ ghb_prefs_store();
+ }
+ }
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
window_configure_cb(
GtkWidget *widget,
GdkEventConfigure *event,
signal_user_data_t *ud)
{
- //g_message("preview_configure_cb()");
if (gtk_widget_get_visible(widget))
{
gint w, h;
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index adf68c136..67a76a3b6 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -87,6 +87,165 @@ conjunction with the "Forced" option.</property>
<property name="label" translatable="yes">&lt;b&gt;Track&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
+
+ <object class="GtkWindow" id="presets_window">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="type_hint">utility</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="transient_for">hb_window</property>
+ <property name="default_width">300</property>
+ <property name="default_height">600</property>
+ <signal name="delete-event" handler="presets_window_delete_cb" swapped="no"/>
+ <signal name="configure-event" handler="presets_window_configure_cb" swapped="no"/>
+ <child>
+ <object class="GtkBox" id="presets_window_box">
+ <property name="orientation">vertical</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <object class="GtkMenuBar" id="presets_menu_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Presets</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="presets_window_submenu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_save">
+ <property name="label" translatable="yes">_Save</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="presets_save_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_remove">
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="presets_remove_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_default">
+ <property name="label" translatable="yes">_Make Default</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="presets_default_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_new_folder">
+ <property name="label" translatable="yes">_New Folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="presets_new_folder_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_export">
+ <property name="label" translatable="yes">_Export</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="preset_export_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_import">
+ <property name="label" translatable="yes">_Import</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="preset_import_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="presets_window_restore">
+ <property name="label" translatable="yes">_Reload Built-in Presets</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="presets_restore_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="presets_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">6</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="presets_scroll">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">etched-in</property>
+ <property name="margin-top">6</property>
+ <property name="min_content_width">200</property>
+ <child>
+ <object class="GtkTreeView" id="presets_list">
+ <property name="width_request">206</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection4"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label34">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Presets List&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+
<object class="GtkWindow" id="activity_window">
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -594,6 +753,7 @@ libx264 authors:
<property name="default_width">500</property>
<property name="default_height">400</property>
<property name="icon_name">hb-icon</property>
+ <signal name="map-event" handler="window_map_cb" swapped="no"/>
<signal name="configure-event" handler="window_configure_cb" swapped="no"/>
<signal name="delete-event" handler="window_delete_event_cb" swapped="no"/>
<signal name="destroy-event" handler="window_destroy_event_cb" swapped="no"/>
@@ -1410,51 +1570,6 @@ This is often the feature title of a DVD.</property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkFrame" id="presets_frame">
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <property name="margin-end">6</property>
- <property name="margin-bottom">6</property>
- <child>
- <object class="GtkScrolledWindow" id="presets_scroll">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">etched-in</property>
- <property name="margin-top">6</property>
- <property name="min_content_width">200</property>
- <child>
- <object class="GtkTreeView" id="presets_list">
- <property name="width_request">206</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="headers_visible">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection4"/>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label34">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">&lt;b&gt;Presets List&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/internal_defaults.json b/gtk/src/internal_defaults.json
index 7d70db5fa..be47bfbc4 100644
--- a/gtk/src/internal_defaults.json
+++ b/gtk/src/internal_defaults.json
@@ -105,6 +105,8 @@
"WhenComplete": "notify",
"SrtDir": "",
"window_width": 1,
- "window_height": 1
+ "window_height": 1,
+ "preset_window_width": 1,
+ "preset_window_height": 1
}
}
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index a4d736fe0..cc80434bd 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -1871,16 +1871,26 @@ preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
GtkResponseType response;
const gchar *exportDir;
gchar *filename;
+ GhbValue *dict;
path = get_selected_path(ud);
if (path == NULL || path->depth <= 0)
{
+ char * new_name;
+
+ free(path);
+ dict = ghb_settings_to_preset(ud->settings);
+ name = ghb_dict_get_string(dict, "PresetName");
+ new_name = g_strdup_printf("%s (modified)", name);
+ ghb_dict_set_string(dict, "PresetName", new_name);
+ free(new_name);
+ }
+ else
+ {
+ dict = hb_value_dup(hb_preset_get(path));
free(path);
- return;
}
- GhbValue *dict = hb_preset_get(path);
- free(path);
if (dict == NULL)
{
return;
@@ -1925,6 +1935,7 @@ preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
g_free(filename);
}
gtk_widget_destroy(dialog);
+ hb_value_free(&dict);
}
G_MODULE_EXPORT void