You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ubl-settings-manager/source/ubl-settings-manager-theme.c

56 lines
2.1 KiB

#include "ubl-settings-manager.h"
theme_struct *yon_theme_update(main_window *widgets){
char *theme_id;
if (!yon_window_config_get_parameter("Settings","theme",&theme_id,YON_TYPE_STRING)){
theme_id = yon_char_new(GNOME_THEME_LABEL);
}
theme_struct *theme = g_hash_table_lookup(main_config.themes,theme_id);
if (theme){
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->ThemeBox));
GList *iter;
for (iter = list;iter;iter=iter->next){
theme_struct *cur_theme = g_object_get_data(G_OBJECT(iter->data),"theme_struct");
if (cur_theme) free(cur_theme);
gtk_widget_destroy(GTK_WIDGET(iter->data));
}
gtk_box_pack_start(GTK_BOX(widgets->ThemeBox),theme->MainBox,1,1,0);
return theme;
} else {
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),THEME_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
}
return NULL;
}
void yon_theme_init(){
theme_struct *gnome_struct = (theme_struct*)yon_gnome_theme_new();
theme_struct *main_struct = (theme_struct*)yon_main_theme_new();
g_hash_table_insert(main_config.themes,yon_char_new(GNOME_THEME_LABEL),gnome_struct);
g_hash_table_insert(main_config.themes,yon_char_new(MAIN_THEME_LABEL),main_struct);
}
void on_main_activate(){
}
void on_main_socket_add(){
}
main_theme_struct *yon_main_theme_new(){
main_theme_struct *theme = malloc(sizeof(gnome_theme_struct));
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_main_theme);
theme->MainBox = yon_gtk_builder_get_widget(builder,"MainBox");
theme->AppsIconView = yon_gtk_builder_get_widget(builder,"AppsIconView");
theme->SocketBox = yon_gtk_builder_get_widget(builder,"SocketBox");
theme->AppsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AppsList"));
theme->Socket = NULL;
g_signal_connect(G_OBJECT(theme->AppsIconView),"item-activated",G_CALLBACK(on_main_activate),theme);
g_signal_connect(G_OBJECT(theme->SocketBox),"add",G_CALLBACK(on_main_socket_add),theme);
return theme;
}