Commit 2147db97 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer
Browse files

app/app_procs.c fill the "last opened" list with the first

1999-05-07  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/app_procs.c
	* app/docindex.[ch]: fill the "last opened" list with
	the first last_opened_size elements of the docindex.

	* app/preferences_dialog.c: fixed the tile_cache_size and
	last_opened_size bugs. Now we can change these values again.
parent 36abb02a
1999-05-07 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/app_procs.c
* app/docindex.[ch]: fill the "last opened" list with
the first last_opened_size elements of the docindex.
* app/preferences_dialog.c: fixed the tile_cache_size and
last_opened_size bugs. Now we can change these values again.
1999-05-07 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel.[ch]
......
......@@ -554,6 +554,33 @@ app_init (void)
devices_init ();
session_init ();
create_toolbox ();
/* Fill the "last opened" menu items with the first last_opened_size
* elements of the docindex
*/
{
FILE *fp;
gchar *filenames[last_opened_size];
int dummy, i;
if ((fp = idea_manager_parse_init (&dummy, &dummy, &dummy, &dummy)))
{
/* read the filenames... */
for (i = 0; i < last_opened_size; i++)
if ((filenames[i] = idea_manager_parse_line (fp)) == NULL)
break;
/* ...and add them in reverse order */
for (--i; i >= 0; i--)
{
menus_last_opened_add (filenames[i]);
g_free (filenames[i]);
}
fclose (fp);
}
}
gximage_init ();
render_setup (transparency_type, transparency_size);
tools_options_dialog_new ();
......
......@@ -1695,8 +1695,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
last_opened_size, 0.0, 256.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gimp_spin_button_new (&adjustment, edit_last_opened_size,
0.0, 16.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
......@@ -1936,7 +1936,7 @@ file_pref_cmd_callback (GtkWidget *widget,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
......
......@@ -14,13 +14,14 @@
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "docindexif.h"
#include "docindex.h"
#include "gimprc.h"
#include "menus.h"
#include "libgimp/gimpenv.h"
......@@ -211,29 +212,59 @@ load_from_list( gpointer data, gpointer data_null )
idea_add_in_position( (gchar *) data, -1 );
}
void
load_idea_manager( idea_manager *ideas )
FILE *
idea_manager_parse_init (/* RETURNS: */
int *window_x,
int *window_y,
int *window_width,
int *window_height)
{
FILE *fp = NULL;
gchar *desktopfile;
if ( ! idea_list )
{
/* open persistant desktop file. */
desktopfile = gimp_personal_rc_file ("ideas");
fp = fopen( desktopfile, "r" );
g_free( desktopfile );
desktopfile = gimp_personal_rc_file ("ideas");
fp = fopen( desktopfile, "r" );
g_free( desktopfile );
/* Read in persistant desktop information. */
if ( fp )
{
x = getinteger( fp );
y = getinteger( fp );
width = getinteger( fp );
height = getinteger( fp );
}
/* Read in persistant desktop information. */
if ( fp )
{
*window_x = getinteger( fp );
*window_y = getinteger( fp );
*window_width = getinteger( fp );
*window_height = getinteger( fp );
}
return fp;
}
gchar *
idea_manager_parse_line (FILE * fp)
{
int length;
gchar *filename;
length = getinteger (fp);
if (!feof( fp ) && !ferror (fp))
{
filename = g_malloc0 (length + 1);
filename[fread (filename, 1, length, fp)] = 0;
clear_white (fp);
return filename;
}
return NULL;
}
void
load_idea_manager( idea_manager *ideas )
{
FILE *fp = NULL;
if ( ! idea_list )
fp = idea_manager_parse_init (&x, &y, &width, &height);
if ( idea_list || fp )
{
gtk_widget_set_usize( ideas->window, width, height );
......@@ -246,14 +277,10 @@ load_idea_manager( idea_manager *ideas )
gint length;
clear_white( fp );
while ( ! feof( fp ) && !ferror( fp ) )
while ((title = idea_manager_parse_line (fp)))
{
length = getinteger( fp );
title = g_malloc0( length + 1 );
title[fread( title, 1, length, fp )] = 0;
idea_add_in_position( title, -1 );
g_free( title );
clear_white( fp );
}
fclose( fp );
}
......@@ -552,4 +579,3 @@ close_idea_window( void )
{
idea_hide_callback( NULL, NULL );
}
......@@ -16,6 +16,8 @@
#ifndef __DOCINDEX_H__
#define __DOCINDEX_H__
#include <stdio.h>
#include <gtk/gtk.h>
typedef struct idea_manager
......@@ -54,7 +56,14 @@ void idea_remove_callback( GtkWidget *widget, gpointer data );
void save_idea_manager( idea_manager * );
gboolean idea_window_delete_event_callback( GtkWidget *widget, GdkEvent *event, gpointer data );
void docindex_configure_drop_on_widget(GtkWidget * widget);
void load_idea_manager( idea_manager * );
FILE * idea_manager_parse_init (int * window_x,
int * window_y,
int * window_width,
int * window_height);
gchar * idea_manager_parse_line (FILE * fp);
void load_idea_manager (idea_manager *);
extern idea_manager *ideas;
......
......@@ -1695,8 +1695,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
last_opened_size, 0.0, 256.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gimp_spin_button_new (&adjustment, edit_last_opened_size,
0.0, 16.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
......@@ -1936,7 +1936,7 @@ file_pref_cmd_callback (GtkWidget *widget,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
......
......@@ -1695,8 +1695,8 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Levels of Undo:"), 1.0, 0.5, spinbutton, TRUE);
spinbutton =
gimp_spin_button_new (&adjustment,
last_opened_size, 0.0, 256.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gimp_spin_button_new (&adjustment, edit_last_opened_size,
0.0, 16.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&edit_last_opened_size);
......@@ -1936,7 +1936,7 @@ file_pref_cmd_callback (GtkWidget *widget,
divided_tile_cache_size,
0.0, (4069.0 * 1024 * 1024), 1.0, 16.0, 0.0,
1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
gtk_signal_connect (GTK_OBJECT (tile_cache_size_adjustment), "value_changed",
(GtkSignalFunc) file_prefs_int_adjustment_callback,
&divided_tile_cache_size);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment