OSDN Git Service

LinGui: clean up hb status handling. mostly just moving things around.
[handbrake-jp/handbrake-jp-git.git] / gtk / src / settings.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  * 
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU Library General Public License for more details.
11  * 
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
15  */
16 #if !defined(_SETTINGS_H_)
17 #define _SETTINGS_H_
18
19 #include <gtk/gtk.h>
20
21 #define PRESET_CUSTOM   1
22 #define PRESET_DEFAULT  2
23
24 #define GHB_WIDGET(b,n) GTK_WIDGET(gtk_builder_get_object ((b), (n)))
25 //#define GHB_WIDGET(b,n)       GTK_WIDGET(debug_get_object((b), (n)))
26 #define GHB_ACTION(b,n) GTK_ACTION(gtk_builder_get_object ((b), (n)))
27 #define GHB_OBJECT(b,n) gtk_builder_get_object ((b), (n))
28
29 GObject* debug_get_object(GtkBuilder *b, const gchar *n);
30
31 enum
32 {
33         GHB_STATE_IDLE          = 0x00,
34         GHB_STATE_SCANNING      = 0x02,
35         GHB_STATE_SCANDONE      = 0x04,
36         GHB_STATE_WORKING       = 0x08,
37         GHB_STATE_WORKDONE      = 0x10,
38         GHB_STATE_PAUSED        = 0x20,
39         GHB_STATE_MUXING        = 0x40,
40 };
41
42 typedef struct
43 {
44         gchar *current_dvd_device;
45         gboolean debug;
46         gboolean dont_clear_presets;
47         GtkBuilder *builder;
48         GHashTable *settings;
49         GSList *audio_settings;
50         gchar **chapter_list;
51         GSList *queue;
52         GIOChannel *activity_log;
53 } signal_user_data_t;
54
55 enum
56 {
57         GHB_QUEUE_PENDING,
58         GHB_QUEUE_RUNNING,
59         GHB_QUEUE_CANCELED,
60         GHB_QUEUE_DONE,
61 };
62
63 typedef struct
64 {
65         gint unique_id;
66         gint status;
67         GHashTable *settings;
68         GSList *audio_settings;
69         gchar **chapter_list;
70 } job_settings_t;
71
72 typedef struct
73 {
74         gint index;
75         gchar *option;
76         gchar *shortOpt;
77         gint ivalue;
78         gdouble dvalue;
79         gchar *svalue;
80 } setting_value_t;
81
82 GHashTable* ghb_settings_new();
83 void ghb_settings_set(GHashTable *settings, const gchar *key, 
84                                           setting_value_t *value);
85 void ghb_settings_set_string(GHashTable *settings, const gchar *key, const gchar *str);
86 void ghb_settings_set_dbl(GHashTable *settings, const gchar *key, gdouble dvalue);
87 void ghb_settings_copy(GHashTable *settings, const gchar *key, const setting_value_t *value);
88 const setting_value_t* ghb_settings_get(GHashTable *settings, const gchar *key);
89 gboolean ghb_settings_get_bool(GHashTable *settings, const gchar *key);
90 gint ghb_settings_get_index(GHashTable *settings, const gchar *key);
91 gint ghb_settings_get_int(GHashTable *settings, const gchar *key);
92 gdouble ghb_settings_get_dbl(GHashTable *settings, const gchar *key);
93 setting_value_t* ghb_widget_value(GtkWidget *widget);
94 gchar* ghb_widget_short_opt(GtkWidget *widget);
95 gchar* ghb_widget_option(GtkWidget *widget);
96 gchar* ghb_widget_string(GtkWidget *widget);
97 gint ghb_widget_int(GtkWidget *widget);
98 gdouble ghb_widget_dbl(GtkWidget *widget);
99 gint ghb_widget_index(GtkWidget *widget);
100
101 const gchar* ghb_settings_get_string(GHashTable *settings, const gchar *key);
102 const gchar* ghb_settings_get_option(GHashTable *settings, const gchar *name);
103 const gchar* ghb_settings_get_short_opt(GHashTable *settings, const gchar *key);
104 GHashTable* ghb_settings_dup(GHashTable *settings);
105 void ghb_widget_to_setting(GHashTable *settings, GtkWidget *widget);
106 int ghb_ui_update(signal_user_data_t *ud, const gchar *key, const gchar *value);
107 int ghb_ui_update_int(signal_user_data_t *ud, const gchar *key, gint ivalue);
108 void ghb_settings_save(signal_user_data_t *ud, const gchar *name);
109 void ghb_presets_load(signal_user_data_t *ud);
110 void ghb_set_preset(signal_user_data_t *ud, const gchar *name);
111 void ghb_update_from_preset( signal_user_data_t *ud, 
112                                                         const gchar *name, const gchar *key);
113 gchar** ghb_presets_get_names();
114 gchar** ghb_presets_get_descriptions();
115 const gchar* ghb_presets_get_name(gint index);
116 gboolean ghb_presets_is_standard(const gchar *name);
117 gboolean ghb_presets_remove(GHashTable *settings, const gchar *name);
118 void ghb_presets_revert(signal_user_data_t *ud, const gchar *name);
119 GdkColor* ghb_presets_color(gboolean modified);
120 const gchar* ghb_presets_current_name();
121 gint ghb_presets_list_index(const gchar *name);
122 gint ghb_preset_flags(const gchar *name, gint *index);
123 void ghb_prefs_load(signal_user_data_t *ud);
124 void ghb_prefs_to_ui(signal_user_data_t *ud);
125 void ghb_prefs_save(GHashTable *settings);
126 void ghb_pref_save(GHashTable *settings, const gchar *key);
127 void ghb_set_preset_default(GHashTable *settings);
128
129 #endif // _SETTINGS_H_