Index: src/main.c =================================================================== RCS file: /cvs/gnome/silky/src/main.c,v retrieving revision 1.159 diff -u -r1.159 main.c --- src/main.c 24 May 2005 19:23:00 -0000 1.159 +++ src/main.c 15 Jun 2005 10:25:13 -0000 @@ -35,6 +35,9 @@ #endif #include +#include +#include + #include "xmlconfig.h" #include "xmllayout.h" #include "support.h" @@ -47,7 +50,7 @@ #include "files.h" #include "log.h" #include "common.h" - +#include "callbacks.h" GladeXML *xmlmain; silkyStruct *silky; /* this is usually used like 'silky->conn' and 'silky->client' */ @@ -90,6 +93,33 @@ gint debug_on = 0; + +/* HILDON */ +HildonApp *app = NULL; +HildonAppView *mainview = NULL; +GtkWidget *mainhbox = NULL; + +static GtkActionEntry action_entries[] = { + { "connect", GTK_STOCK_ADD, + "connect", "", NULL, + G_CALLBACK(on_show_server_connect_window) }, + { "preferences", GTK_STOCK_ADD, + "preferences", "", NULL, + G_CALLBACK(on_settings) }, +}; + +static guint n_action_entries = G_N_ELEMENTS(action_entries); + +static const gchar *ui_info = +" " +" " +" " +" " +" "; + +/* /HILDON */ + + /***************************/ @@ -730,6 +760,72 @@ g_error ("wasn't able to schedule silky_ping\n"); /* quitting here */ } + + + /* HILDON */ + GtkUIManager *ui; + GtkActionGroup *actions; + GtkToolbar *toolbar; + GError *error = NULL; + gpointer user_data = NULL; + // GtkMenuBar *mainmenubar = NULL; + GtkMenu *mainmenu; + // GtkWidget *menu_others; + GtkWidget *item_foobar; + + app = HILDON_APP(hildon_app_new()); + mainview = HILDON_APPVIEW(hildon_appview_new("main_view")); + + hildon_app_set_appview(app, mainview); + hildon_app_set_title(app, "Silky"); + + /* move Silky to different container */ + GtkWidget *silkywindow = glade_xml_get_widget (xmlmain, "window_main"); + GtkWidget *silkyhbox = glade_xml_get_widget (xmlmain, "vbox1"); + + g_object_ref(silkyhbox); + gtk_container_remove(GTK_CONTAINER(silkywindow), silkyhbox); + gtk_container_add(GTK_CONTAINER(mainview), silkyhbox); + g_object_unref(silkyhbox); + /* make it all visible */ + gtk_widget_show_all(GTK_WIDGET(app)); + + /* HILDON MENU */ + mainmenu = hildon_appview_get_menu(mainview); + item_foobar = gtk_menu_item_new_with_label(_("Foobar")); + gtk_menu_append(mainmenu, item_foobar); + /* add more menus here */ + + gtk_widget_show_all(GTK_WIDGET(mainmenu)); + + + /* HILDON APP */ + user_data = app; + signal(SIGINT, control_c); + actions = gtk_action_group_new("Actions"); + g_assert(actions); + gtk_action_group_add_actions(actions, action_entries, n_action_entries, user_data); + + /* UI */ + ui = gtk_ui_manager_new(); + g_assert(ui); + + gtk_ui_manager_insert_action_group(ui, actions, 0); + /* check error here */ + + + if (!gtk_ui_manager_add_ui_from_string(ui, ui_info, -1, &error)) { + g_error("can't start ui: %s", error->message); + g_error_free(error); + g_assert(FALSE); + } + + toolbar = GTK_TOOLBAR(gtk_ui_manager_get_widget(ui, "/ToolBar")); + g_assert(toolbar); + gtk_toolbar_set_orientation(toolbar, GTK_ORIENTATION_HORIZONTAL); + gtk_toolbar_set_style(toolbar, GTK_TOOLBAR_ICONS); + hildon_appview_set_toolbar(mainview, toolbar); + /* /HILDON */ silky_gui_show_main(); update_presence_button();