Changeset 5169


Ignore:
Timestamp:
Feb 28, 2008, 8:23:02 PM (14 years ago)
Author:
charles
Message:

(gtk) make verrmsg_full() private

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-core.c

    r5122 r5169  
    2929
    3030#include <libtransmission/transmission.h>
    31 #include <libtransmission/utils.h> /* tr_strcmp */
     31#include <libtransmission/utils.h> /* tr_free */
    3232
    3333#include "conf.h"
  • trunk/gtk/util.c

    r5122 r5169  
    2323 *****************************************************************************/
    2424
    25 #include <sys/types.h>
    26 #include <sys/stat.h>
    27 #include <signal.h>
    2825#include <stdarg.h>
    29 #include <string.h>
    30 #include <stdlib.h>
    31 #include <unistd.h>
     26#include <stdlib.h> /* free() */
     27#include <string.h> /* strcmp() */
    3228
    3329#include <gtk/gtk.h>
     
    3632#include <libevent/evhttp.h>
    3733
     34#include <libtransmission/transmission.h> /* TR_RATIO_NA, TR_RATIO_INF */
     35
    3836#include "conf.h"
    3937#include "tr-prefs.h"
    40 #include "tr-torrent.h"
    4138#include "util.h"
    42 
    43 static void
    44 errcb(GtkWidget *wind, int resp, gpointer data);
    4539
    4640int
     
    267261}
    268262
    269 void
    270 errmsg( GtkWindow * wind, const char * format, ... )
    271 {
    272     GtkWidget * dialog;
    273     va_list     ap;
    274 
    275     va_start( ap, format );
    276     dialog = verrmsg_full( wind, NULL, NULL, format, ap );
    277     va_end( ap );
    278 
    279     if( NULL != wind && !GTK_WIDGET_MAPPED( GTK_WIDGET( wind ) ) )
    280     {
    281         g_signal_connect_swapped( wind, "map",
    282                                   G_CALLBACK( gtk_widget_show ), dialog );
    283     }
    284     else
    285     {
    286         gtk_widget_show( dialog );
    287     }
    288 }
    289 
    290 GtkWidget *
    291 errmsg_full( GtkWindow * wind, callbackfunc_t func, void * data,
    292              const char * format, ... )
    293 {
    294     GtkWidget * dialog;
    295     va_list     ap;
    296 
    297     va_start( ap, format );
    298     dialog = verrmsg_full( wind, func, data, format, ap );
    299     va_end( ap );
    300 
    301     return dialog;
    302 }
    303 
    304 GtkWidget *
     263static void
     264errcb(GtkWidget *widget, int resp UNUSED, gpointer data) {
     265  GList *funcdata;
     266  callbackfunc_t func;
     267
     268  if(NULL != data) {
     269    funcdata = g_list_first(data);
     270    func = (callbackfunc_t) funcdata->data;
     271    data = funcdata->next->data;
     272    func(data);
     273    g_list_free(funcdata);
     274  }
     275
     276  gtk_widget_destroy(widget);
     277}
     278
     279static GtkWidget *
    305280verrmsg_full( GtkWindow * wind, callbackfunc_t func, void * data,
    306281              const char * format, va_list ap )
     
    330305}
    331306
    332 static void
    333 errcb(GtkWidget *widget, int resp UNUSED, gpointer data) {
    334   GList *funcdata;
    335   callbackfunc_t func;
    336 
    337   if(NULL != data) {
    338     funcdata = g_list_first(data);
    339     func = (callbackfunc_t) funcdata->data;
    340     data = funcdata->next->data;
    341     func(data);
    342     g_list_free(funcdata);
    343   }
    344 
    345   gtk_widget_destroy(widget);
     307void
     308errmsg( GtkWindow * wind, const char * format, ... )
     309{
     310    GtkWidget * dialog;
     311    va_list     ap;
     312
     313    va_start( ap, format );
     314    dialog = verrmsg_full( wind, NULL, NULL, format, ap );
     315    va_end( ap );
     316
     317    if( NULL != wind && !GTK_WIDGET_MAPPED( GTK_WIDGET( wind ) ) )
     318    {
     319        g_signal_connect_swapped( wind, "map",
     320                                  G_CALLBACK( gtk_widget_show ), dialog );
     321    }
     322    else
     323    {
     324        gtk_widget_show( dialog );
     325    }
     326}
     327
     328GtkWidget *
     329errmsg_full( GtkWindow * wind, callbackfunc_t func, void * data,
     330             const char * format, ... )
     331{
     332    GtkWidget * dialog;
     333    va_list     ap;
     334
     335    va_start( ap, format );
     336    dialog = verrmsg_full( wind, func, data, format, ap );
     337    va_end( ap );
     338
     339    return dialog;
    346340}
    347341
  • trunk/gtk/util.h

    r5101 r5169  
    102102             const char * format, ... ) G_GNUC_PRINTF(4,5);
    103103
    104 /* varargs version of errmsg_full() */
    105 GtkWidget *
    106 verrmsg_full( GtkWindow * wind, callbackfunc_t func, void * data,
    107               const char * format, va_list ap );
    108 
    109104/* pop up the context menu if a user right-clicks.
    110105   if the row they right-click on isn't selected, select it. */
Note: See TracChangeset for help on using the changeset viewer.