static void anjuta_window_maximize_widget (AnjutaShell *shell, const char *widget_name, GError **error) { AnjutaWindow *win = NULL; GtkWidget *dock_item = NULL; gpointer value, key; GtkWidget *widget = NULL; GHashTableIter iter; /* AnjutaWindow assertions */ g_return_if_fail (ANJUTA_IS_WINDOW (shell)); win = ANJUTA_WINDOW (shell); /* If win->maximized is TRUE then another widget is already maximized. Restoring the UI for a new maximization. */ if(win->maximized) gdl_dock_layout_load_layout (win->layout_manager, "back-up"); /* Back-up the layout so it can be restored */ gdl_dock_layout_save_layout(win->layout_manager, "back-up"); /* Mark the win as maximized (the other widgets except center are hidden) */ win->maximized = TRUE; /* Hide all DockItem's except the ones positioned in the center */ g_hash_table_iter_init (&iter, win->widgets); while (g_hash_table_iter_next (&iter, &key, &value)) { if (value == NULL) continue; /* Widget assertions */ widget = GTK_WIDGET (value); if(!GTK_IS_WIDGET (widget)) continue; /* DockItem assertions */ dock_item = g_object_get_data (G_OBJECT (widget), "dockitem"); if(dock_item == NULL || !GDL_IS_DOCK_ITEM (dock_item)) continue; if(!g_strcmp0((gchar*)key, widget_name)) { /* If it's the widget requesting maximization then make sure the * widget is visible*/ gdl_dock_item_show_item (GDL_DOCK_ITEM (dock_item)); } else { /* Hide the other item */ gdl_dock_item_hide_item (GDL_DOCK_ITEM (dock_item)); } } }
void Ganash::ApplicationWindow::set_layout(std::string filename) { GdlDockLayout * layout = gdl_dock_layout_new(G_OBJECT(_dockbar->gobj())); if(gdl_dock_layout_load_from_file (GDL_DOCK_LAYOUT (layout), filename.c_str())) { if (!gdl_dock_layout_load_layout (GDL_DOCK_LAYOUT (layout), "__default__")) { g_warning ("Loading layout failed!!"); } } else { g_print("Load failed\n"); } }
static void anjuta_window_unmaximize (AnjutaShell *shell, GError **error) { AnjutaWindow *win = NULL; /* AnjutaWindow assertions */ g_return_if_fail (ANJUTA_IS_WINDOW (shell)); win = ANJUTA_WINDOW (shell); /* If not maximized then the operation doesn't make sence. */ g_return_if_fail (win->maximized); /* Load the backed-up layout */ gdl_dock_layout_load_layout (win->layout_manager, "back-up"); gdl_dock_layout_delete_layout (win->layout_manager, "back-up"); /* Un-mark maximized */ win->maximized = FALSE; }