Example #1
0
static void
restore_state(GitgWindow *window)
{
	GitgSettings *settings = gitg_settings_get_default();
	gint dw;
	gint dh;

	gtk_window_get_default_size(GTK_WINDOW(window), &dw, &dh);
	
	gtk_window_set_default_size(GTK_WINDOW(window), 
							    gitg_settings_get_window_width(settings, dw), 
							    gitg_settings_get_window_height(settings, dh));

	gint orig = gtk_paned_get_position(GTK_PANED(window->priv->vpaned_main));
	gtk_paned_set_position(GTK_PANED(window->priv->vpaned_main),
						   gitg_settings_get_vpaned_main_position(settings, orig));
						   
	orig = gtk_paned_get_position(GTK_PANED(window->priv->vpaned_commit));
	gtk_paned_set_position(GTK_PANED(window->priv->vpaned_commit),
						   gitg_settings_get_vpaned_commit_position(settings, orig));

	orig = gtk_paned_get_position(GTK_PANED(window->priv->hpaned_commit));
	gtk_paned_set_position(GTK_PANED(window->priv->hpaned_commit),
						   gitg_settings_get_hpaned_commit_position(settings, orig));

	orig = gtk_paned_get_position(GTK_PANED(window->priv->revision_tree_view));
	gtk_paned_set_position(GTK_PANED(window->priv->revision_tree_view),
						   gitg_settings_get_revision_tree_view_position(settings, orig));
}
Example #2
0
void
notes_area_get_pane_sizes (NotesArea *na, int *vp, int *hp)
{
	if (!na) return;
	if(vp) *vp = gtk_paned_get_position (na->vpane);
	if(hp) *hp = gtk_paned_get_position (na->hpane);
}
Example #3
0
gboolean classbrowser_accept_size(GtkPaned *paned, gpointer user_data)
{
    if (gtk_paned_get_position(GTK_PANED(main_window.main_horizontal_pane)) != 0) {
        set_preferences_manager_classbrowser_size(main_window.prefmg, gtk_paned_get_position(GTK_PANED(main_window.main_horizontal_pane)));
    }
    return TRUE;
}
Example #4
0
static gboolean classbrowser_accept_size(GtkPaned    *paned,
                                                        GdkRectangle *allocation,
                                                        gpointer      user_data)
{
    if (gtk_paned_get_position(paned) != 0) {
        MainWindow *main_window = (MainWindow *) user_data;
        gint size = gtk_paned_get_position(paned);
        g_object_set(main_window->prefmg, "side_panel_size", size, NULL);
    }
    return TRUE;
}
Example #5
0
static void
liferea_shell_save_position (void)
{
	GtkWidget	*pane;
	gint		x, y, w, h;
	gboolean	last_window_maximized;

	/* save pane proportions */
	pane = liferea_shell_lookup ("leftpane");
	if (pane) {
		x = gtk_paned_get_position (GTK_PANED (pane));
		conf_set_int_value (LAST_VPANE_POS, x);
	}

	pane = liferea_shell_lookup ("normalViewPane");
	if (pane) {
		y = gtk_paned_get_position (GTK_PANED (pane));
		conf_set_int_value (LAST_HPANE_POS, y);
	}

	pane = liferea_shell_lookup ("wideViewPane");
	if (pane) {
		y = gtk_paned_get_position (GTK_PANED (pane));
		conf_set_int_value (LAST_WPANE_POS, y);
	}
	
	/* The following needs to be skipped when the window is not visible */
	if (!gtk_widget_get_visible (GTK_WIDGET (shell->priv->window)))
		return;

	conf_get_bool_value (LAST_WINDOW_MAXIMIZED, &last_window_maximized);

	if (last_window_maximized)
		return;

	gtk_window_get_position (shell->priv->window, &x, &y);
	gtk_window_get_size (shell->priv->window, &w, &h);

	if (x+w<0 || y+h<0 ||
	    x > gdk_screen_width () ||
	    y > gdk_screen_height ())
		return;

	debug4 (DEBUG_GUI, "Saving window size and position: %dx%d %d:%d", w, h, x, y);

	/* save window position */
	conf_set_int_value (LAST_WINDOW_X, x);
	conf_set_int_value (LAST_WINDOW_Y, y);

	/* save window size */
	conf_set_int_value (LAST_WINDOW_WIDTH, w);
	conf_set_int_value (LAST_WINDOW_HEIGHT, h);
}
Example #6
0
void MainWindow::updateScrollbarSidebarPosition() {
	XOJ_CHECK_TYPE(MainWindow);

	GtkWidget * panelMainContents = get("panelMainContents");
	GtkWidget * sidebarContents = get("sidebarContents");
	GtkWidget * tableXournal = get("tableXournal");

	bool scrollbarOnLeft = control->getSettings()->isScrollbarOnLeft();

	Layout * layout = this->getLayout();

	GtkWidget * v = layout->getScrollbarVertical();

	if (gtk_widget_get_parent(v) != NULL) {
		gtk_container_remove(GTK_CONTAINER(tableXournal), v);
	}

	ScrollbarHideType type = this->getControl()->getSettings()->getScrollbarHideType();

	if (type == SCROLLBAR_HIDE_NONE || type == SCROLLBAR_HIDE_HORIZONTAL) {
		if (scrollbarOnLeft) {
			gtk_table_attach(GTK_TABLE(tableXournal), v, 0, 1, 0, 1, (GtkAttachOptions) 0, GTK_FILL, 0, 0);
		} else {
			gtk_table_attach(GTK_TABLE(tableXournal), v, 2, 3, 0, 1, (GtkAttachOptions) 0, GTK_FILL, 0, 0);
		}
	}

	Sidebar * sidebar = this->control->getSidebar();
	if (sidebar) {
		sidebar->setBackgroundWhite();
	}

	int divider = gtk_paned_get_position(GTK_PANED(panelMainContents));
	bool sidebarRight = control->getSettings()->isSidebarOnRight();
	if (sidebarRight == (gtk_paned_get_child2(GTK_PANED(panelMainContents)) == sidebarContents)) {
		// Already correct
		return;
	} else {
		GtkAllocation allocation;
		gtk_widget_get_allocation(panelMainContents, &allocation);
		divider = allocation.width - divider;
	}

	g_object_ref(sidebarContents);
	g_object_ref(tableXournal);

	gtk_container_remove(GTK_CONTAINER(panelMainContents), sidebarContents);
	gtk_container_remove(GTK_CONTAINER(panelMainContents), tableXournal);

	if (sidebarRight) {
		gtk_paned_pack1(GTK_PANED(panelMainContents), tableXournal, true, true);
		gtk_paned_pack2(GTK_PANED(panelMainContents), sidebarContents, false, true);
	} else {
		gtk_paned_pack1(GTK_PANED(panelMainContents), sidebarContents, false, true);
		gtk_paned_pack2(GTK_PANED(panelMainContents), tableXournal, true, true);
	}

	g_object_unref(sidebarContents);
	g_object_unref(tableXournal);
}
Example #7
0
void main_window_set_playlist_visible(MainWindow *wnd, gboolean visible)
{
	gint offset;
	gint handle_pos;
	gint width;
	gint height;

	offset = main_window_get_csd_enabled(wnd)?PLAYLIST_CSD_OFFSET:0;
	handle_pos = gtk_paned_get_position(GTK_PANED(wnd->vid_area_paned));

	gtk_window_get_size(GTK_WINDOW(wnd), &width, &height);

	if(!visible && wnd->playlist_visible)
	{
		wnd->playlist_width = width-handle_pos;
	}

	wnd->playlist_visible = visible;

	gtk_widget_set_visible(wnd->playlist, visible);

	/* For some unknown reason, width needs to be adjusted by some offset
	 * (50px) when CSD is enabled for the resulting size to be correct.
	 */
	gtk_window_resize(	GTK_WINDOW(wnd),
				visible
				?width+wnd->playlist_width-offset
				:handle_pos+offset,
				height );
}
Example #8
0
int
_gtk_paned_get_position2 (GtkPaned *paned)
{
	int             pos;
	GtkWidget      *w;
	GtkRequisition  requisition;
	int             size;

	if (! GTK_WIDGET_VISIBLE (paned))
		return 0;

	pos = gtk_paned_get_position (paned);
	if (pos == 0)
		return 0;

	w = gtk_widget_get_toplevel (GTK_WIDGET (paned));
	if (! GTK_WIDGET_TOPLEVEL (w))
		return 0;

	gtk_window_get_size (GTK_WINDOW (w), &(requisition.width), &(requisition.height));
	if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL)
		size = requisition.width;
	else
		size = requisition.height;

	if (size == 0)
		return 0;

	return size - pos;
}
Example #9
0
static void
close_task_area (GtkButton *but, NotesArea *na)
{
	int hpane_width;
	int hpane_div;

	hpane_width = GTK_WIDGET(na->hpane)->allocation.width;
	hpane_div = gtk_paned_get_position (na->hpane);

	/* XXX we really need only the first test, but the second
	 * one deals iwth a freaky gtk vpaned bug that makes this
	 * hidden button active.  Whatever.
	 */
	if ((hpane_div < CLOSED_MARGIN) ||
	    (hpane_div > hpane_width -CLOSED_MARGIN))
	{
		int vpane_height;
		vpane_height = GTK_WIDGET(na->vpane)->allocation.height;
		gtk_paned_set_position (na->vpane, vpane_height);
	}
	else
	{
		gtk_paned_set_position (na->hpane, hpane_width);
	}
}
Example #10
0
void	main_window_save_state ()
{
	if (!gtk_widget_get_visible (window))
		return;

	gint width, height, xpos, ypos;

	gtk_window_get_size (GTK_WINDOW(window), &width, &height);
	gtk_window_get_position (GTK_WINDOW(window), &xpos, &ypos);

	rookie_settings_set_window_width  (width);
	rookie_settings_set_window_height (height);

	rookie_settings_set_sidepane_width (gtk_paned_get_position (GTK_PANED(hpaned)));
	rookie_settings_set_bottompane_width (gtk_paned_get_position (GTK_PANED(vpaned)));
}
Example #11
0
/**
 * A callback for when the position of a GtkPaned slider changes
 *
 * This function is responsible for storing the width or height of the Buddy
 * List as a preference after the user changes it by dragging the slider.
 *
 * @param[in] gobject    Pointer to the GtkPaned structure that was resized
 * @param[in] pspec      Unused
 * @param[in] data       Pointer to the Buddy List that is a parent of gobject
**/
static void notify_position_cb(GObject *gobject, U GParamSpec *pspec,
			       gpointer data)
{
	PidginBuddyList *
	    gtkblist;      /*< Buddy List window containing these panes */
	gint max_position; /*< The "max-position" property of gobject   */
	gint size;	 /*< Current size of the Buddy List pane      */

	gtkblist = data;
	size = gtk_paned_get_position(GTK_PANED(gobject));

	/* If the Buddy List is not the first pane, invert the size preference.
	 */
	if (gtk_paned_get_child1(GTK_PANED(gobject)) != gtkblist->notebook) {
		g_object_get(gobject, "max-position", &max_position, NULL);
		size = max_position - size;
	}

	/* Store this size as a user preference (depending on paned
	 * orientation). */
	if (GTK_IS_VPANED(gobject))
		purple_prefs_set_int(PREF_HEIGHT, size);
	else
		purple_prefs_set_int(PREF_WIDTH, size);
}
Example #12
0
static void
save_state(GitgWindow *window)
{
	GitgSettings *settings = gitg_settings_get_default();
	GtkAllocation *allocation = &(GTK_WIDGET(window)->allocation);
	
	gitg_settings_set_window_width(settings, allocation->width);
	gitg_settings_set_window_height(settings, allocation->height);

	gitg_settings_set_vpaned_main_position(settings, gtk_paned_get_position(GTK_PANED(window->priv->vpaned_main)));
	gitg_settings_set_vpaned_commit_position(settings, gtk_paned_get_position(GTK_PANED(window->priv->vpaned_commit)));
	gitg_settings_set_hpaned_commit_position(settings, gtk_paned_get_position(GTK_PANED(window->priv->hpaned_commit)));
	gitg_settings_set_revision_tree_view_position(settings, gtk_paned_get_position(GTK_PANED(window->priv->revision_tree_view)));

	gitg_settings_save(settings);
}
Example #13
0
static gboolean
DestroyHelpWindow( GtkWidget *win, GdkEvent *event, void *ptr )
{
	int i;
	GtkWidget *widget;
	char tmp[ 20 ];
	
	gint x, y;
	
	/* get the slider position and save it */
	widget = lookup_widget( win, PANED );
	i = gtk_paned_get_position( GTK_PANED( widget ));
	wPrefSetInteger( HTMLHELPSECTION, SLIDERPREFNAME, i );
	
	/* get the window position */
	gtk_window_get_position( (GtkWindow *)win, &x, &y ); 
	sprintf( tmp, "%d %d", x, y );
	wPrefSetString( HTMLHELPSECTION, WINDOWPOSPREFNAME, tmp );
	
	/* get the window size */	
	gtk_window_get_size( (GtkWindow *)win , &x, &y );
	sprintf( tmp, "%d %d", x, y );
	wPrefSetString( HTMLHELPSECTION, WINDOWSIZEPREFNAME, tmp );
	
	gtk_widget_hide( win );
	return TRUE;
}
Example #14
0
void remmina_ftp_client_save_state(RemminaFTPClient *client, RemminaFile *remminafile)
{
	gint pos;

	pos = gtk_paned_get_position(GTK_PANED(client->priv->vpaned));
	remmina_file_set_int(remminafile, "ftp_vpanedpos", pos);
}
Example #15
0
/* Toggles the contents pane */
void contents_button_clicked(GtkWidget *widget, gpointer data) {
        if (gtk_paned_get_position(GTK_PANED(data)) < 50) {
                gtk_paned_set_position(GTK_PANED(data), 370);
        }
        else {
                gtk_paned_set_position(GTK_PANED(data), 0);
        }
}
static void
brasero_file_chooser_position_changed (GObject *object,
                                       GParamSpec *param_spec,
                                       gpointer NULL_data)
{
	GtkAllocation allocation = {0, 0};
	gint position;

	gtk_widget_get_allocation (GTK_WIDGET (object), &allocation);
	position = gtk_paned_get_position (GTK_PANED (object));
	brasero_file_chooser_position_percent (object, allocation.width, position);
}
Example #17
0
void l_restdok2_znm(class restdok2_data *data)
{
const char *imaf={".iceb_l_restdok2.dat"};
FILE *ff;

if((ff = fopen(imaf,"w")) == NULL)
 {
  iceb_er_op_fil(imaf,"",errno,data->window);
  return;
 }

int kol_pix=gtk_paned_get_position(GTK_PANED(data->gor_panel));
fprintf(ff,"Количество пикселов для разделения горизонтальных панелей|%d\n",kol_pix);

kol_pix=gtk_paned_get_position(GTK_PANED(data->gor_panel));
fprintf(ff,"Количество пикселов для разделения вертикальных панелей|%d\n",kol_pix);

fclose(ff);


}
Example #18
0
void
hide_music_browser(void) {

	options.browser_on = 0;
	gtk_window_get_position(GTK_WINDOW(browser_window), &options.browser_pos_x, &options.browser_pos_y);
	gtk_window_get_size(GTK_WINDOW(browser_window), &options.browser_size_x, &options.browser_size_y);
	if (!options.hide_comment_pane) {
		options.browser_paned_pos = gtk_paned_get_position(GTK_PANED(browser_paned));
	}
	gtk_widget_hide(browser_window);
	register_toplevel_window(browser_window, TOP_WIN_SKIN);
}
Example #19
0
int
clip_GTK_PANEDGETPOSITION(ClipMachine * cm)
{
	C_widget  *cpan = _fetch_cw_arg(cm);
	gint   position;
	CHECKCWID(cpan,GTK_IS_PANED);
	position = gtk_paned_get_position(GTK_PANED(cpan->widget));

	_clip_retni(cm, position);
	return 0;
err:
	return 1;
}
Example #20
0
static void
store_position(GObject    *gobject,
               GParamSpec *arg1,
               gpointer    user_data)
{
	GtkPaned *paned = GTK_PANED(gobject);
	GConfClient *client;
	gint position;
	
	client = gconf_client_get_default();
	position = gtk_paned_get_position(paned);
	gconf_client_set_int(client, PANEL_KEY "/panel_position", position, NULL);
	
	g_object_unref(client);
}
static void
brasero_file_chooser_allocation_changed (GtkWidget *widget,
                                         GtkAllocation *allocation,
                                         gpointer NULL_data)
{
	gint position;
	gint width;

	/* See if it's the first allocation. If so set the position and don't
	 * save it */
	if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "position_set")) == FALSE) {
		gpointer percent;
		GtkWidget *toplevel;

		toplevel = gtk_widget_get_toplevel (GTK_WIDGET (widget));
		if (G_TYPE_FROM_INSTANCE (toplevel) == GTK_TYPE_FILE_CHOOSER_DIALOG) {
			g_object_set_data (G_OBJECT (widget), "is-stock-file-chooser", GINT_TO_POINTER (1));
			brasero_setting_get_value (brasero_setting_get_default (),
				                   BRASERO_SETTING_STOCK_FILE_CHOOSER_PERCENT,
				                   &percent);
		}
		else
			brasero_setting_get_value (brasero_setting_get_default (),
				                   BRASERO_SETTING_BRASERO_FILE_CHOOSER_PERCENT,
				                   &percent);

		if (GPOINTER_TO_INT (percent) >= 0) {
			position = allocation->width * GPOINTER_TO_INT (percent) / 10000;
			gtk_paned_set_position (GTK_PANED (widget), position);
		}
		else
			gtk_paned_set_position (GTK_PANED (widget), 30 * allocation->width / 100);

		/* Don't connect to position signal until it was first allocated */
		g_object_set_data (G_OBJECT (widget), "position_set", GINT_TO_POINTER (TRUE));
		g_signal_connect (widget,
		                  "notify::position",
		                  G_CALLBACK (brasero_file_chooser_position_changed),
		                  NULL);
		return;
	}

	position = gtk_paned_get_position (GTK_PANED (widget));
	width = allocation->width;

	brasero_file_chooser_position_percent (G_OBJECT (widget), width, position);
}
Example #22
0
static gboolean paned_button_release_event(GtkWidget *widget,
					   GdkEventButton *event,
					   gpointer user_data)
{
	gint panesize;
	gchar layout[80];

	panesize = gtk_paned_get_position(GTK_PANED(widget));

	if (panesize > 15) {
		settings.sidebar_notebook_height = panesize;
		sprintf(layout, "%d", settings.sidebar_notebook_height);
		xml_set_value("Xiphos", "layout",
			      "sidebar_notebook_height", layout);
	}
	return FALSE;
}
Example #23
0
static void
dialog_unmap (GtkWidget *window,
              GtkWidget *paned)
{
  DialogData data;

  gtk_window_get_size (GTK_WINDOW (window), &data.width, &data.height);

  data.paned_position = gtk_paned_get_position (GTK_PANED (paned));
  data.show_index     = gtk_widget_get_visible (sidebar);

  data.zoom = (view ?
               webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view)) : 1.0);

  gimp_set_data (GIMP_HELP_BROWSER_DIALOG_DATA, &data, sizeof (data));

  gtk_main_quit ();
}
Example #24
0
File: tasks.c Project: rosedu/osmo
void
show_tasks_desc_panel (gboolean enable, GUI *appGUI) {

GtkTreeIter  iter;
GdkRectangle rect, visible_rect;
GtkTreePath  *visible_path;
GtkTreeModel *model;

    if(enable == TRUE) {

        if (gtk_tree_selection_get_selected (appGUI->tsk->tasks_list_selection, &model, &iter)) {

            gtk_paned_set_position(GTK_PANED(appGUI->tsk->tasks_paned), config.tasks_pane_pos);

            while (g_main_context_iteration(NULL, FALSE));

            visible_path = gtk_tree_model_get_path (model, &iter);

            if (visible_path) {

                gtk_tree_view_get_cell_area (GTK_TREE_VIEW (appGUI->tsk->tasks_list), visible_path, NULL, &rect);
                gtk_tree_view_get_visible_rect (GTK_TREE_VIEW (appGUI->tsk->tasks_list), &visible_rect);

                if (rect.y < visible_rect.y || rect.y > visible_rect.y + visible_rect.height) {
                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (appGUI->tsk->tasks_list), visible_path, NULL, TRUE, 0.5, 0.0);
                }

                gtk_tree_path_free(visible_path);
            }

        } else {
            enable = FALSE;
        }

    } else {

        config.tasks_pane_pos = gtk_paned_get_position(GTK_PANED(appGUI->tsk->tasks_paned));
        gtk_paned_set_position(GTK_PANED(appGUI->tsk->tasks_paned), 99999);

    }

    appGUI->tsk->tasks_panel_status = enable;
}
Example #25
0
GimpSessionInfoBook *
gimp_session_info_book_from_widget (GimpDockbook *dockbook)
{
  GimpSessionInfoBook *info;
  GtkWidget           *parent;
  GList               *children;
  GList               *list;

  g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);

  info = gimp_session_info_book_new ();

  parent = gtk_widget_get_parent (GTK_WIDGET (dockbook));

  if (GTK_IS_VPANED (parent))
    {
      GtkPaned *paned = GTK_PANED (parent);

      if (GTK_WIDGET (dockbook) == gtk_paned_get_child2 (paned))
        info->position = gtk_paned_get_position (paned);
    }

  info->current_page =
    gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));

  children = gtk_container_get_children (GTK_CONTAINER (dockbook));

  for (list = children; list; list = g_list_next (list))
    {
      GimpSessionInfoDockable *dockable;

      dockable = gimp_session_info_dockable_from_widget (list->data);

      info->dockables = g_list_prepend (info->dockables, dockable);
    }

  info->dockables = g_list_reverse (info->dockables);

  g_list_free (children);

  return info;
}
Example #26
0
void SetupSave (void) {
	char cfgfile[PATH_MAX];
	FILE *cfg_fp;
	int n = 0;
	char homedir[PATH_MAX];
	get_home_dir(homedir);
	setlocale(LC_NUMERIC, "C");
	snprintf(cfgfile, PATH_MAX, "%s%s.cammill.cfg", homedir, DIR_SEP);
	cfg_fp = fopen(cfgfile, "w");
	if (cfg_fp == NULL) {
		fprintf(stderr, "Can not write Setup: %s\n", cfgfile);
		return;
	}
	for (n = 0; n < P_LAST; n++) {
		char name_str[1024];
		snprintf(name_str, sizeof(name_str), "%s|%s", PARAMETER[n].group, PARAMETER[n].name);
		if (PARAMETER[n].type == T_FLOAT) {
			fprintf(cfg_fp, "%s=%f\n", name_str, PARAMETER[n].vfloat);
		} else if (PARAMETER[n].type == T_DOUBLE) {
			fprintf(cfg_fp, "%s=%f\n", name_str, PARAMETER[n].vdouble);
		} else if (PARAMETER[n].type == T_INT) {
			fprintf(cfg_fp, "%s=%i\n", name_str, PARAMETER[n].vint);
		} else if (PARAMETER[n].type == T_SELECT) {
			fprintf(cfg_fp, "%s=%i\n", name_str, PARAMETER[n].vint);
		} else if (PARAMETER[n].type == T_BOOL) {
			fprintf(cfg_fp, "%s=%i\n", name_str, PARAMETER[n].vint);
		} else if (PARAMETER[n].type == T_STRING) {
			fprintf(cfg_fp, "%s=%s\n", name_str, PARAMETER[n].vstr);
		} else if (PARAMETER[n].type == T_FILE) {
			fprintf(cfg_fp, "%s=%s\n", name_str, PARAMETER[n].vstr);
		}
	}
	if (PARAMETER[P_O_PARAVIEW].vint == 0) {
		fprintf(cfg_fp, "GUI|PANED|Position=%i\n", gtk_paned_get_position(GTK_PANED(hbox)));

		int gn = 0;
		for (gn = 0; gn < G_LAST; gn++) {
			fprintf(cfg_fp, "GUI|EXPANDER|%s=%i\n", GROUPS[gn].name, gtk_expander_get_expanded(GTK_EXPANDER(GroupExpander[gn])));
		}
	}
	fclose(cfg_fp);
}
Example #27
0
static void
close_proj_area (GtkButton *but, NotesArea *na)
{
	int hpane_width;
	int hpane_div;

	hpane_width = GTK_WIDGET(na->hpane)->allocation.width;
	hpane_div = gtk_paned_get_position (na->hpane);

	if (hpane_div > hpane_width -CLOSED_MARGIN)
	{
		int vpane_height;
		vpane_height = GTK_WIDGET(na->vpane)->allocation.height;
		gtk_paned_set_position (na->vpane, vpane_height);
	}
	else
	{
		gtk_paned_set_position (na->hpane, 0);
	}
}
Example #28
0
/* callback to show and hide the curves pane */
G_MODULE_EXPORT void 
on_view_curves (GtkObject *object, gpointer user_data)
{
     GtkWidget *divider_w, *menu_w, *btn_w, *visnote_w;
     GtkAllocation vis_alloc;
     int position, vis_width;
     static int saved_div_position = 0;

     divider_w = get_widget("graph_divider");
     menu_w = get_widget("m_view_curves");
     btn_w = get_widget("view_metrics_btn");
     visnote_w = get_widget("visualisation_notebook");

     g_signal_handlers_block_by_func(G_OBJECT(object), 
				     G_CALLBACK(on_view_curves), NULL);

     position = gtk_paned_get_position(GTK_PANED(divider_w));
     gtk_widget_get_allocation(visnote_w, &vis_alloc);
     vis_width = vis_alloc.width;

     /* if the divider is set to have a very small gap to the right hand 
      * edge then it is assumed that the curves are hidden to all intents.
      * The gap is measured against the edge of the visualisation_notebook */
     if (position + 50 < vis_width) {
          /* hide by setting the position to 9999 */
	  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_w), FALSE);
	  gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(btn_w),
					    FALSE);
	  gtk_paned_set_position(GTK_PANED(divider_w), 9999);
	  saved_div_position = position;
     } else {
          /* show curve list by restoring the previous divider position */
	  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_w), TRUE);
	  gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(btn_w),
					    TRUE);
	  gtk_paned_set_position(GTK_PANED(divider_w), saved_div_position);
     }

     g_signal_handlers_unblock_by_func(G_OBJECT(object), 
				       G_CALLBACK(on_view_curves), NULL);
}
static void
fr_file_selector_dialog_unmap (GtkWidget *widget)
{
	FrFileSelectorDialog *self;
	int                   width;
	int                   height;

	self = FR_FILE_SELECTOR_DIALOG (widget);

	gtk_window_get_size (GTK_WINDOW (self), &width, &height);
	g_settings_set (self->priv->settings, PREF_FILE_SELECTOR_WINDOW_SIZE, "(ii)", width, height);
	g_settings_set_boolean (self->priv->settings, PREF_FILE_SELECTOR_SHOW_HIDDEN, self->priv->show_hidden);
	g_settings_set_int (self->priv->settings,
			    PREF_FILE_SELECTOR_SIDEBAR_SIZE,
			    gtk_paned_get_position (GTK_PANED (GET_WIDGET ("main_paned"))));

	if (self->priv->current_operation != NULL)
		g_cancellable_cancel (self->priv->current_operation->cancellable);

	GTK_WIDGET_CLASS (fr_file_selector_dialog_parent_class)->unmap (widget);
}
/** Save enough information about this page that it can be recreated next time
 * the user starts gnucash.
 * @param plugin_page The page to save.
 * @param key_file A pointer to the GKeyFile data structure where the
 * page information should be written.
 * @param group_name The group name to use when saving data.
 **/
static void
gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page,
                                   GKeyFile *key_file,
                                   const gchar *group_name)
{
    GncPluginPageSxList *page;
    GncPluginPageSxListPrivate *priv;

    g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST(plugin_page));
    g_return_if_fail(key_file != NULL);
    g_return_if_fail(group_name != NULL);

    page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
    priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);

    g_key_file_set_integer(key_file, group_name, "dense_cal_num_months",
                           gnc_dense_cal_get_num_months(priv->gdcal));

    g_key_file_set_integer(key_file, group_name, "paned_position",
                           gtk_paned_get_position(GTK_PANED(priv->widget)));
}