Beispiel #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));
}
Beispiel #2
0
int
main (int argc, char **argv)
{
	gboolean ret;

	g_thread_init (NULL);

	gitg_debug_init ();

	bindtextdomain (GETTEXT_PACKAGE, GITG_LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	g_set_prgname ("gitg");

	/* Translators: this is the application name as in g_set_application_name */
	g_set_application_name (_("gitg"));

	gitg_dirs_initialize (argc, argv);
	gtk_init (&argc, &argv);
	parse_options (&argc, &argv);

	set_language_search_path ();
	set_style_scheme_search_path ();
	set_icons ();

	GitgSettings *settings = gitg_settings_get_default ();
	GitgWindow *window = build_ui ();

	ret = gitg_window_load_repository_for_command_line (window,
	                                                    argc - 1,
	                                                    (gchar const **)argv + 1,
	                                                    select_sha1);

	if (commit_mode && ret)
	{
		gitg_window_show_commit (window);
	}

	original_link_button_hook = gtk_link_button_set_uri_hook ((GtkLinkButtonUriFunc)link_button_uri_hook,
	                                                          window,
	                                                          NULL);

	gtk_main ();

	/* Finalize settings */
	g_object_unref (settings);
	return 0;
}
Beispiel #3
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);
}