2005-12-20 [paul] 1.9.100cvs96
[claws.git] / src / account.c
index 7e43593ca5a81629261f7bc042d88f205ee4ed91..e05f8c841d8bbfb73c21a982250bd2479d7a1aec 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -102,6 +102,8 @@ static void account_edit_close              (GtkWidget *widget, gpointer data);
 static gint account_delete_event       (GtkWidget      *widget,
                                         GdkEventAny    *event,
                                         gpointer        data);
+static void account_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation);
 static gboolean account_key_pressed    (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
@@ -184,7 +186,7 @@ void account_read_config_all(void)
        debug_print("Reading all config for each account...\n");
 
        rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ACCOUNT_RC, NULL);
-       if ((fp = fopen(rcpath, "rb")) == NULL) {
+       if ((fp = g_fopen(rcpath, "rb")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
                g_free(rcpath);
                return;
@@ -347,6 +349,11 @@ void account_set_menu(void)
        main_window_set_account_menu(account_list);
 }
 
+void account_set_menu_only_toolbar(void)
+{
+       main_window_set_account_menu_only_toolbar(account_list);
+}
+
 void account_foreach(AccountFunc func, gpointer user_data)
 {
        GList *cur;
@@ -598,6 +605,17 @@ void account_destroy(PrefsAccount *ac_prefs)
        }
 }
 
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void account_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.accountswin_width = allocation->width;
+       prefs_common.accountswin_height = allocation->height;
+}
 
 static void account_edit_create(void)
 {
@@ -621,10 +639,11 @@ static void account_edit_create(void)
        GtkWidget *hbbox;
        GtkWidget *close_btn;
 
+       static GdkGeometry geometry;
+
        debug_print("Creating account edit window...\n");
 
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-       gtk_widget_set_size_request (window, 500, 350);
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_window_set_title (GTK_WINDOW (window), _("Edit accounts"));
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
@@ -742,6 +761,19 @@ static void account_edit_create(void)
 
        account_create_list_view_images(list_view);
 
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(account_size_allocate_cb), NULL);
+
+       if (!geometry.min_height) {
+               geometry.min_width = 500;
+               geometry.min_height = 350;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.accountswin_width,
+                                   prefs_common.accountswin_height);
+
        edit_account.window    = window;
        edit_account.list_view = list_view;
        edit_account.close_btn = close_btn;