1 /* 2 * settings.h 3 * Copyright (C) John Stebbins 2008-2021 <stebbins@stebbins> 4 * 5 * settings.h is free software. 6 * 7 * You may redistribute it and/or modify it under the terms of the 8 * GNU General Public License version 2, as published by the Free Software 9 * Foundation. 10 * 11 * settings.h is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 * See the GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with callbacks.h. If not, write to: 18 * The Free Software Foundation, Inc., 19 * 51 Franklin Street, Fifth Floor 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #if !defined(_SETTINGS_H_) 24 #define _SETTINGS_H_ 25 26 #include <gtk/gtk.h> 27 #include "values.h" 28 29 #define GHB_WIDGET(b,n) GTK_WIDGET(gtk_builder_get_object ((b), (n))) 30 //#define GHB_WIDGET(b,n) GTK_WIDGET(debug_get_object((b), (n))) 31 #define GHB_OBJECT(b,n) gtk_builder_get_object ((b), (n)) 32 33 GObject* debug_get_object(GtkBuilder *b, const gchar *n); 34 35 enum 36 { 37 GHB_STATE_IDLE = 0x00, 38 GHB_STATE_SCANNING = 0x02, 39 GHB_STATE_SCANDONE = 0x04, 40 GHB_STATE_WORKING = 0x08, 41 GHB_STATE_WORKDONE = 0x10, 42 GHB_STATE_PAUSED = 0x20, 43 GHB_STATE_MUXING = 0x40, 44 GHB_STATE_SEARCHING = 0x80, 45 }; 46 47 enum 48 { 49 GHB_CANCEL_NONE, 50 GHB_CANCEL_ALL, 51 GHB_CANCEL_CURRENT, 52 GHB_CANCEL_FINISH 53 }; 54 55 typedef struct preview_s preview_t; 56 57 typedef struct 58 { 59 gchar *current_dvd_device; 60 gboolean debug; 61 gboolean dont_clear_presets; 62 gboolean scale_busy; 63 gint cancel_encode; 64 GtkBuilder * builder; 65 GhbValue * globals; 66 GhbValue * prefs; 67 GhbValue * settings; 68 GhbValue * settings_array; 69 GhbValue * queue; 70 GIOChannel * activity_log; 71 GIOChannel * job_activity_log; 72 GtkTextBuffer * activity_buffer; 73 GtkTextBuffer * queue_activity_buffer; 74 GtkTextBuffer * extra_activity_buffer; 75 char * extra_activity_path; 76 gboolean append_queue_activity; 77 preview_t * preview; 78 gchar * appcast; 79 gint appcast_len; 80 int stderr_src_id; 81 GtkApplication * app; 82 } signal_user_data_t; 83 84 enum 85 { 86 GHB_QUEUE_PENDING, 87 GHB_QUEUE_RUNNING, 88 GHB_QUEUE_CANCELED, 89 GHB_QUEUE_FAIL, 90 GHB_QUEUE_DONE, 91 }; 92 93 void ghb_settings_copy( 94 GhbValue *settings, const gchar *key, const GhbValue *value); 95 gint ghb_settings_combo_int(const GhbValue *settings, const gchar *key); 96 gdouble ghb_settings_combo_double(const GhbValue *settings, const gchar *key); 97 gchar* ghb_settings_combo_option(const GhbValue *settings, const gchar *key); 98 99 GhbValue *ghb_get_job_settings(GhbValue *settings); 100 GhbValue* ghb_widget_value(GtkWidget *widget); 101 gchar* ghb_widget_string(GtkWidget *widget); 102 gdouble ghb_widget_double(GtkWidget *widget); 103 gint64 ghb_widget_int64(GtkWidget *widget); 104 gint ghb_widget_int(GtkWidget *widget); 105 gint ghb_widget_boolean(GtkWidget *widget); 106 107 void ghb_widget_to_setting(GhbValue *settings, GtkWidget *widget); 108 int ghb_ui_update( 109 signal_user_data_t *ud, const gchar *name, const GhbValue *value); 110 int ghb_ui_update_from_settings( 111 signal_user_data_t *ud, const gchar *name, const GhbValue *settings); 112 int ghb_ui_settings_update( 113 signal_user_data_t *ud, GhbValue *settings, const gchar *name, 114 const GhbValue *value); 115 const gchar* ghb_get_setting_key(GtkWidget *widget); 116 void ghb_update_widget(GtkWidget *widget, const GhbValue *value); 117 118 #endif // _SETTINGS_H_ 119