ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/src prefs_window.c,1.2,1.3


From: Philip S Tellis <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src prefs_window.c,1.2,1.3
Date: Wed, 05 Feb 2003 03:32:32 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv23868/src

Modified Files:
        prefs_window.c 
Log Message:
ok/cancel buttons even for no prefs

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs_window.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- prefs_window.c      5 Feb 2003 06:39:42 -0000       1.2
+++ prefs_window.c      5 Feb 2003 08:32:27 -0000       1.3
@@ -123,24 +123,24 @@
 #endif
               build_modules_prefs(prefs_note);
          }
-   
+
          /*Okay Button*/
          hbox = gtk_hbox_new(FALSE, 5);
          hbox2 = gtk_hbox_new(TRUE, 5);
          gtk_widget_set_usize(hbox2, 200,25);
-   
+
          icon = gdk_pixmap_create_from_xpm_d(prefs_window->window, &mask, 
NULL, ok_xpm);
          iconwid = gtk_pixmap_new(icon, mask);
          label = gtk_label_new(_("Ok"));
-   
+
          gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
          gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
-   
+
          gtk_widget_show(iconwid);
          gtk_widget_show(label);
-   
+
          button = gtk_button_new();
-   
+
          gtk_signal_connect(GTK_OBJECT(button), "clicked", 
                             ok_callback, prefs_window);
 
@@ -148,26 +148,26 @@
                                     GTK_SIGNAL_FUNC (gtk_widget_destroy),
                                     GTK_OBJECT (prefs_window));
          gtk_widget_show(hbox);
-   
+
          gtk_container_add (GTK_CONTAINER (button), hbox);
-   
+
          gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 5);
          gtk_widget_show(button);
-   
+
          /*Cancel Button*/
          hbox = gtk_hbox_new(FALSE, 5);
          icon = gdk_pixmap_create_from_xpm_d(prefs_window->window, &mask, 
NULL, cancel_xpm);
          iconwid = gtk_pixmap_new(icon, mask);
          label = gtk_label_new(_("Cancel"));
-   
+
          gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
          gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
-      
+
          gtk_widget_show(iconwid);
          gtk_widget_show(label);
-   
+
          button = gtk_button_new();
-   
+
          gtk_signal_connect(GTK_OBJECT(button), "clicked", 
                             cancel_callback, prefs_window);
 
@@ -175,18 +175,18 @@
                                     GTK_SIGNAL_FUNC (gtk_widget_destroy),
                                     GTK_OBJECT (prefs_window));
          gtk_widget_show(hbox);
-   
+
          gtk_container_add (GTK_CONTAINER (button), hbox);
-   
+
          gtk_box_pack_start(GTK_BOX(hbox2), button, TRUE, TRUE, 5);
          gtk_widget_show(button);
-   
+
          /*End Buttons*/
          hbox = gtk_hbox_new(FALSE, 5);
-       
+
          gtk_box_pack_end(GTK_BOX(hbox), hbox2, FALSE, FALSE, 5);
          gtk_widget_show(hbox2);
-   
+
          gtk_box_pack_start(GTK_BOX(prefs_vbox), hbox, FALSE, FALSE, 5);
          gtk_widget_show(hbox);
          gtk_widget_show(prefs_vbox);
@@ -294,7 +294,7 @@
     label = gtk_label_new(buff2);
     //gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
     //gtk_widget_show(label);
-    
+
     g_snprintf(buff, 10, "%d", iGetLocalPref("length_contact_window"));
     //gtk_entry_set_text(GTK_ENTRY(length_contact_window_entry), buff);
     //gtk_box_pack_start(GTK_BOX(hbox), length_contact_window_entry,
@@ -549,7 +549,7 @@
      GtkWidget *hbox = NULL;
      GSList            *group = NULL;
      GtkWidget *label = NULL;
-     
+
      vbox = gtk_vbox_new(FALSE, 5);
 
      /* Values */
@@ -581,7 +581,7 @@
                       set_tco_element);
      group = eb_radio (group, _("Right"),  do_tabbed_chat_orient, 3, hbox,
                       set_tco_element);
-    
+
      /* bug here , var gets messed up. why ? */
      do_tabbed_chat_orient = do_tabbed_chat_orient_old;
      /* Put it in the vbox and make it visible */
@@ -675,7 +675,7 @@
        GtkWidget *label = GTK_BIN(keybutton)->child;
        /* remove stupid things like.. numlock scrolllock and capslock
         * mod1 = alt, mod2 = numlock, mod3 = modeshift/altgr, mod4 = meta, 
mod5 = scrolllock */
-       
+
        int state = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | 
GDK_MOD1_MASK | GDK_MOD4_MASK);
        if (state != 0) {
                        /* this unfortunately was the only way I could do this 
without using
@@ -716,15 +716,15 @@
 
        if(accel_change_handler_id == 0) {
                gtk_label_set_text(GTK_LABEL(label), _("Please press new key 
and modifier now."));
-       
+
                gtk_object_set_data(GTK_OBJECT(keybutton), "accel", userdata);
-               
+
                /* it's sad how this works: It grabs the events in the event 
mask
                 * of the widget the mouse is over, NOT the grabbed widget.
                 * Oh, and persistantly clicking makes the grab go away...
                 */
                gtk_grab_add(keybutton);
-               
+
                accel_change_handler_id = gtk_signal_connect_after 
(GTK_OBJECT(keybutton),
                                        "key_press_event",
                                        GTK_SIGNAL_FUNC (newkey_callback),
@@ -752,7 +752,7 @@
      clabel=gtk_accelerator_name(keydata->keyval, keydata->modifiers);
      button = gtk_button_new_with_label(clabel);
      g_free(clabel);
-        
+
      gtk_signal_connect(GTK_OBJECT(button), "clicked", 
                        GTK_SIGNAL_FUNC(getnewkey), 
                        (gpointer)keydata);
@@ -812,7 +812,7 @@
     label = gtk_label_new(_("Font size: "));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
     gtk_widget_show(label);
-    
+
     font_size_entry = gtk_entry_new();
     gtk_widget_set_usize(font_size_entry, 60, -1);
     g_snprintf(buff, 10, "%d", 
iGetLocalPref("FontSize")==0?4:iGetLocalPref("FontSize"));
@@ -848,7 +848,7 @@
         do_ignore_fore = do_ignore_fore_old;
         do_ignore_back = do_ignore_back_old;
         do_ignore_font = do_ignore_font_old;    
-        
+
         accel_next_tab = accel_next_tab_old;
         accel_prev_tab = accel_prev_tab_old;
 }
@@ -924,7 +924,7 @@
      gtk_widget_show(button);
      gtk_signal_connect(GTK_OBJECT(button), "clicked", 
                        GTK_SIGNAL_FUNC(set_proxy_type), (gpointer)PROXY_NONE);
-       
+
      if(proxy_type == PROXY_NONE)
      {
          gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
@@ -942,7 +942,7 @@
          gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
      }
 
-       
+
      button = 
gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(button)),
                                               _("Use SOCKS4 Proxy"));
      gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
@@ -1054,7 +1054,7 @@
      char buff[10];
 
      new_proxy_type = proxy_type;
-       
+
      if(proxy_host)
      {
          gtk_entry_set_text(GTK_ENTRY(proxy_server_entry), proxy_host);
@@ -1428,18 +1428,22 @@
 
 static void update_plugin_prefs(GtkWidget * w, input_list *prefs)
 {
-       eb_debug(DBG_MOD, "updating prefs\n");
-       eb_input_accept(prefs);
-       
+       if(prefs) {
+               eb_debug(DBG_MOD, "updating prefs\n");
+               eb_input_accept(prefs);
+       }
+
        gtk_widget_destroy(plugin_prefs_win);
        plugin_prefs_win = NULL;
 }
 
 static void cancel_plugin_prefs( GtkWidget *w, input_list *prefs )
 {
-       eb_debug(DBG_MOD, "canceling prefs\n");
-       eb_input_cancel( prefs );
-       
+       if(prefs) {
+               eb_debug(DBG_MOD, "cancelling prefs\n");
+               eb_input_cancel( prefs );
+       }
+
        gtk_widget_destroy( plugin_prefs_win );
        plugin_prefs_win = NULL;
 }
@@ -1517,13 +1521,13 @@
        {
                GString         *windowName = g_string_new( NULL );
                const char      *pluginDescr = _("Plugin");
-               
+
                if ( epi->service != NULL )
                        pluginDescr = epi->service;
-               
+
                windowName = g_string_append( windowName, pluginDescr );
                windowName = g_string_append( windowName, _(" Preferences") );
-               
+
                eb_debug(DBG_MOD, "Setting prefs for %s\n", plugin_path);
 
                /* Create the window if it doesn't exist. */
@@ -1531,10 +1535,10 @@
                {
                        plugin_prefs_win = gtk_window_new( GTK_WINDOW_DIALOG );
                        gtk_widget_realize( plugin_prefs_win );
-                       
+
                        gtk_window_set_position( GTK_WINDOW(plugin_prefs_win), 
GTK_WIN_POS_MOUSE) ;
                        gtk_window_set_policy( GTK_WINDOW(plugin_prefs_win), 
FALSE, FALSE, TRUE );
-                                                       
+
                        gtk_container_border_width( 
GTK_CONTAINER(plugin_prefs_win), 5 );
 
                        gtk_signal_connect(GTK_OBJECT(plugin_prefs_win), 
"destroy",
@@ -1545,91 +1549,29 @@
                        /* otherwise just destroy it's current contents */
                        gtk_widget_destroy( GTK_BIN(plugin_prefs_win)->child );
                }
-               
+
                gtk_window_set_title( GTK_WINDOW(plugin_prefs_win), 
windowName->str );
-               
-               if ( epi->pi.prefs != NULL )
+
                {
-                       GtkWidget       *button = NULL;
-                       GtkWidget       *hbox = NULL;
-                       GtkWidget       *label = NULL;
-                       GtkWidget       *iconwid = NULL;
-                       GdkPixmap       *icon = NULL;
-                       GdkBitmap       *mask = NULL;
-                       GtkWidget       *buttonHBox = gtk_hbox_new( TRUE, 5 );
-                       GtkWidget       *vbox = gtk_vbox_new( FALSE, 5 );
+               GtkWidget       *button = NULL;
+               GtkWidget       *hbox = NULL;
+               GtkWidget       *label = NULL;
+               GtkWidget       *iconwid = NULL;
+               GdkPixmap       *icon = NULL;
+               GdkBitmap       *mask = NULL;
+               GtkWidget       *buttonHBox = gtk_hbox_new( TRUE, 5 );
+               GtkWidget       *vbox = gtk_vbox_new( FALSE, 5 );
 
 
-                       /* Show the plugin prefs */
+               /* Show the plugin prefs */
+               if ( epi->pi.prefs != NULL )
                        eb_input_render( epi->pi.prefs, vbox );
-                       
-                       gtk_widget_set_usize( buttonHBox, 200, 25 );
-                       gtk_widget_show( buttonHBox );
-                                 
-                       /* OK Button*/
-                       hbox = gtk_hbox_new( FALSE, 5 );
-
-                       icon = gdk_pixmap_create_from_xpm_d( 
plugin_prefs_win->window, &mask, NULL, ok_xpm );
-                       iconwid = gtk_pixmap_new( icon, mask );
-                       label = gtk_label_new( _("Ok") );
-                       button = gtk_button_new();
-                       
-                       gtk_box_pack_start( GTK_BOX(hbox), iconwid, FALSE, 
FALSE, 2 );
-                       gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 
2 );
-
-                       gtk_widget_show( iconwid );
-                       gtk_widget_show( label );
-                       gtk_widget_show( hbox );
-                       gtk_widget_show( button );
-
-                       gtk_signal_connect( GTK_OBJECT(button), "clicked",
-                                       GTK_SIGNAL_FUNC(update_plugin_prefs), 
(gpointer)epi->pi.prefs );
-            
-                       gtk_container_add( GTK_CONTAINER(button), hbox );
-   
-                       gtk_box_pack_start( GTK_BOX(buttonHBox), button, TRUE, 
TRUE, 5 );
-   
-                       /*Cancel Button*/
-                       hbox = gtk_hbox_new( FALSE, 5 );
-
-                       icon = 
gdk_pixmap_create_from_xpm_d(plugin_prefs_win->window, &mask, NULL, cancel_xpm);
-                       iconwid = gtk_pixmap_new(icon, mask);
-                       label = gtk_label_new(_("Cancel"));
-                       button = gtk_button_new();
-
-                       gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, 
FALSE, 2);
-                       gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 
2);
-
-                       gtk_widget_show( iconwid );
-                       gtk_widget_show( label  );
-                       gtk_widget_show( hbox );
-                       gtk_widget_show( button );
-                       
-                       gtk_signal_connect(GTK_OBJECT(button), "clicked",
-                                          
GTK_SIGNAL_FUNC(cancel_plugin_prefs), (gpointer)epi->pi.prefs );
-
-                       gtk_container_add( GTK_CONTAINER (button), hbox );
-
-                       gtk_box_pack_start( GTK_BOX(buttonHBox), button, TRUE, 
TRUE, 5 );
-
-                       /* ICK!  use another hbox to put the buttons over on 
the right */
-                       hbox = gtk_hbox_new( FALSE, 5 );
-                       gtk_widget_show( hbox );        
-                       gtk_box_pack_end( GTK_BOX(hbox), buttonHBox, FALSE, 
FALSE, 5 );
-
-                       gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 
5);
-
-                       gtk_widget_show( vbox );
-
-                       gtk_container_add( GTK_CONTAINER(plugin_prefs_win), 
GTK_WIDGET(vbox) );
-               }
-               else
-               {
+               else {
                        GtkLabel        *label = GTK_LABEL(gtk_label_new( NULL 
));
                        GString         *labelText = g_string_new( _("No 
preferences for ") );
                        int             newWidth = 0;
                        int             newHeight = 0;
-                       
+
                        if ( epi->service != NULL )
                        {
                                labelText = g_string_append( labelText, 
epi->service );
@@ -1640,7 +1582,7 @@
                                labelText = g_string_append( labelText, 
epi->pi.brief_desc );
                                labelText = g_string_append( labelText, "'" );
                        }
-                       
+
                        gtk_label_set_text( label, labelText->str );
                        gtk_widget_show( GTK_WIDGET(label) );
 
@@ -1648,19 +1590,82 @@
                        newHeight = GTK_WIDGET(label)->allocation.height;
                        if ( newHeight < 50 )
                                newHeight = 50;
-                               
+
                        gtk_widget_set_usize( GTK_WIDGET(label), newWidth, 
newHeight );
-                       
-                       gtk_container_add(GTK_CONTAINER(plugin_prefs_win), 
GTK_WIDGET(label));
+
+                       /*gtk_container_add(GTK_CONTAINER(plugin_prefs_win), 
GTK_WIDGET(label));*/
+                       gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(label), 
FALSE, FALSE, 2);
 
                        eb_debug(DBG_MOD, "No prefs defined for %s\n", 
plugin_path);
-               
+
                        g_string_free( labelText, TRUE );
                }
-               
+
+
+               gtk_widget_set_usize( buttonHBox, 200, 25 );
+               gtk_widget_show( buttonHBox );
+
+               /* OK Button*/
+               hbox = gtk_hbox_new( FALSE, 5 );
+
+               icon = gdk_pixmap_create_from_xpm_d( plugin_prefs_win->window, 
&mask, NULL, ok_xpm );
+               iconwid = gtk_pixmap_new( icon, mask );
+               label = gtk_label_new( _("Ok") );
+               button = gtk_button_new();
+
+               gtk_box_pack_start( GTK_BOX(hbox), iconwid, FALSE, FALSE, 2 );
+               gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 2 );
+
+               gtk_widget_show( iconwid );
+               gtk_widget_show( label );
+               gtk_widget_show( hbox );
+               gtk_widget_show( button );
+
+               gtk_signal_connect( GTK_OBJECT(button), "clicked",
+                               GTK_SIGNAL_FUNC(update_plugin_prefs), 
(gpointer)epi->pi.prefs );
+
+               gtk_container_add( GTK_CONTAINER(button), hbox );
+
+               gtk_box_pack_start( GTK_BOX(buttonHBox), button, TRUE, TRUE, 5 
);
+
+               /*Cancel Button*/
+               hbox = gtk_hbox_new( FALSE, 5 );
+
+               icon = gdk_pixmap_create_from_xpm_d(plugin_prefs_win->window, 
&mask, NULL, cancel_xpm);
+               iconwid = gtk_pixmap_new(icon, mask);
+               label = gtk_label_new(_("Cancel"));
+               button = gtk_button_new();
+
+               gtk_box_pack_start(GTK_BOX(hbox), iconwid, FALSE, FALSE, 2);
+               gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
+
+               gtk_widget_show( iconwid );
+               gtk_widget_show( label  );
+               gtk_widget_show( hbox );
+               gtk_widget_show( button );
+
+               gtk_signal_connect(GTK_OBJECT(button), "clicked",
+                                  GTK_SIGNAL_FUNC(cancel_plugin_prefs), 
(gpointer)epi->pi.prefs );
+
+               gtk_container_add( GTK_CONTAINER (button), hbox );
+
+               gtk_box_pack_start( GTK_BOX(buttonHBox), button, TRUE, TRUE, 5 
);
+
+               /* ICK!  use another hbox to put the buttons over on the right 
*/
+               hbox = gtk_hbox_new( FALSE, 5 );
+               gtk_widget_show( hbox );        
+               gtk_box_pack_end( GTK_BOX(hbox), buttonHBox, FALSE, FALSE, 5 );
+
+               gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+
+               gtk_widget_show( vbox );
+
+               gtk_container_add( GTK_CONTAINER(plugin_prefs_win), 
GTK_WIDGET(vbox) );
+               }
+
                gtk_widget_show( plugin_prefs_win );
                gdk_window_raise( plugin_prefs_win->window );
-               
+
                g_string_free( windowName, TRUE );
        }
 }
@@ -1694,7 +1699,7 @@
        label = gtk_label_new(_("Module Paths"));
        gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0);
        gtk_widget_show(label);
-       
+
        button = eb_push_button(_("Rescan"), vbox2);
        gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0);
        gtk_widget_show(vbox2);
@@ -1739,7 +1744,7 @@
                        GTK_SIGNAL_FUNC(plugin_selected), NULL);
 
        gtk_widget_show(label);
-       
+
        gtk_notebook_append_page(GTK_NOTEBOOK(prefs_note), vbox, 
gtk_label_new(_("Modules")));
        gtk_widget_show(vbox);
        gtk_widget_show(GTK_WIDGET(module_list));
@@ -1869,7 +1874,7 @@
      volume_sound_old = iGetLocalPref("SoundVolume");
 
      /* General Tab */
- 
+
     sound_vbox = gtk_vbox_new(FALSE, 5);
      gtk_widget_show(sound_vbox);
 
@@ -2110,23 +2115,23 @@
      case BUDDY_ARRIVE:
          playsoundfile(cGetLocalPref("BuddyArriveFilename"));
          break;
-               
+
      case BUDDY_LEAVE:
          playsoundfile(cGetLocalPref("BuddyLeaveFilename"));
          break;
-       
+
      case SEND:
          playsoundfile(cGetLocalPref("SendFilename"));
          break;
-       
+
      case RECEIVE:
          playsoundfile(cGetLocalPref("ReceiveFilename"));
          break;
-       
+
      case BUDDY_AWAY:
          playsoundfile(cGetLocalPref("BuddyAwayFilename"));
          break;
-       
+
      case FIRSTMSG:
          playsoundfile(cGetLocalPref("FirstMsgFilename"));
          break;
@@ -2177,7 +2182,7 @@
 /*
  * Reading/Writing Prefs
  */
- 
+
 enum {
        CORE_PREF,
        PLUGIN_PREF,
@@ -2203,7 +2208,7 @@
        cSetLocalPref("ReceiveFilename", ReceiveDefault);
        cSetLocalPref("SendFilename", SendDefault);
        iSetLocalPref("FontSize", font_size_def);
-       
+
        g_snprintf(buff, 1024, "%sprefs",config_dir);
        fp = fopen(buff, "r");
        if(!fp)
@@ -2323,7 +2328,7 @@
                if(!strcasecmp(param, "do_ayttm_debug"))
                        do_ayttm_debug = iGetLocalPref("do_ayttm_debug");
        }
-       
+
        /* general prefs */
        do_login_on_startup   = iGetLocalPref("do_login_on_startup");
        do_plugin_debug       = iGetLocalPref("do_plugin_debug");
@@ -2339,11 +2344,11 @@
        do_logging            = iGetLocalPref("do_logging");
        do_strip_html         = iGetLocalPref("do_strip_html");
        do_restore_last_conv  = iGetLocalPref("do_restore_last_conv");
-       
+
        /* layout prefs */
        do_tabbed_chat        = iGetLocalPref("do_tabbed_chat");
        do_tabbed_chat_orient = iGetLocalPref("do_tabbed_chat_orient");
-       
+
        /* sound prefs */
        do_online_sound       = iGetLocalPref("do_online_sound");
        do_no_sound_when_away = iGetLocalPref("do_no_sound_when_away");
@@ -2351,7 +2356,7 @@
        do_play_send          = iGetLocalPref("do_play_send");
        do_play_first         = iGetLocalPref("do_play_first");
        do_play_receive       = iGetLocalPref("do_play_receive");
-       
+
        /* chat prefs */
        do_typing_notify      = iGetLocalPref("do_typing_notify");
        do_send_typing_notify = iGetLocalPref("do_send_typing_notify");
@@ -2368,10 +2373,10 @@
        do_ignore_back        = iGetLocalPref("do_ignore_back");
        do_ignore_font        = iGetLocalPref("do_ignore_font");
        do_smiley             = iGetLocalPref("do_smiley");
-       
+
        gtk_accelerator_parse(cGetLocalPref("accel_next_tab"), 
&(accel_next_tab.keyval), &(accel_next_tab.modifiers));
        gtk_accelerator_parse(cGetLocalPref("accel_prev_tab"), 
&(accel_prev_tab.keyval), &(accel_prev_tab.modifiers));
-       
+
 #ifdef HAVE_ICONV_H
        use_recoding          =iGetLocalPref("use_recoding");
 #endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]