Changeset 8846 for trunk/gtk/util.c


Ignore:
Timestamp:
Jul 22, 2009, 3:55:48 PM (13 years ago)
Author:
charles
Message:

remove some unused utilities. better commenting on the utils that remain.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/util.c

    r8758 r8846  
    1 /******************************************************************************
    2  * $Id$
     1/*
     2 * This file Copyright (C) 2008-2009 Charles Kerr <charles@transmissionbt.com>
    33 *
    4  * Copyright (c) 2005-2008 Transmission authors and contributors
     4 * This file is licensed by the GPL version 2.  Works owned by the
     5 * Transmission project are granted a special exemption to clause 2(b)
     6 * so that the bulk of its code can remain under the MIT license.
     7 * This exemption does not extend to derived works not owned by
     8 * the Transmission project.
    59 *
    6  * Permission is hereby granted, free of charge, to any person obtaining a
    7  * copy of this software and associated documentation files (the "Software"),
    8  * to deal in the Software without restriction, including without limitation
    9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    10  * and/or sell copies of the Software, and to permit persons to whom the
    11  * Software is furnished to do so, subject to the following conditions:
    12  *
    13  * The above copyright notice and this permission notice shall be included in
    14  * all copies or substantial portions of the Software.
    15  *
    16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    22  * DEALINGS IN THE SOFTWARE.
    23  *****************************************************************************/
     10 * $Id:$
     11 */
    2412
    2513#include <ctype.h> /* isxdigit() */
     
    305293    g_free( pwd );
    306294    return g_slist_reverse( ret );
    307 }
    308 
    309 static void
    310 onErrorResponse( GtkWidget * dialog,
    311                  int resp    UNUSED,
    312                  gpointer    glist )
    313 {
    314     GSList * list = glist;
    315 
    316     if( list )
    317     {
    318         callbackfunc_t func = list->data;
    319         gpointer       user_data = list->next->data;
    320         func( user_data );
    321         g_slist_free( list );
    322     }
    323 
    324     gtk_widget_destroy( dialog );
    325 }
    326 
    327 static GtkWidget *
    328 verrmsg_full( GtkWindow *    wind,
    329               callbackfunc_t func,
    330               void *         data,
    331               const char *   format,
    332               va_list        ap )
    333 {
    334     GtkWidget *dialog;
    335     char *     msg;
    336     GSList *   funcdata = NULL;
    337 
    338     msg = g_strdup_vprintf( format, ap );
    339 
    340     if( NULL == wind )
    341         dialog = gtk_message_dialog_new(
    342             NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", msg );
    343     else
    344         dialog = gtk_message_dialog_new(
    345             wind,
    346             GTK_DIALOG_MODAL |
    347             GTK_DIALOG_DESTROY_WITH_PARENT,
    348             GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
    349             "%s", msg );
    350 
    351     if( func )
    352     {
    353         funcdata = g_slist_append( funcdata, (gpointer)func );
    354         funcdata = g_slist_append( funcdata, data );
    355     }
    356     g_signal_connect( dialog, "response", G_CALLBACK(
    357                           onErrorResponse ), funcdata );
    358     g_free( msg );
    359 
    360     return dialog;
    361295}
    362296
     
    402336    g_free( secondary );
    403337}
    404 
    405 void
    406 errmsg( GtkWindow *  wind,
    407         const char * format,
    408         ... )
    409 {
    410     GtkWidget * dialog;
    411     va_list     ap;
    412 
    413     va_start( ap, format );
    414     dialog = verrmsg_full( wind, NULL, NULL, format, ap );
    415     va_end( ap );
    416 
    417     if( NULL != wind && !GTK_WIDGET_MAPPED( GTK_WIDGET( wind ) ) )
    418     {
    419         g_signal_connect_swapped( wind, "map",
    420                                   G_CALLBACK( gtk_widget_show ), dialog );
    421     }
    422     else
    423     {
    424         gtk_widget_show( dialog );
    425     }
    426 }
    427 
    428 GtkWidget *
    429 errmsg_full( GtkWindow *    wind,
    430              callbackfunc_t func,
    431              void *         data,
    432              const char *   format,
    433              ... )
    434 {
    435     GtkWidget * dialog;
    436     va_list     ap;
    437 
    438     va_start( ap, format );
    439     dialog = verrmsg_full( wind, func, data, format, ap );
    440     va_end( ap );
    441 
    442     return dialog;
    443 }
    444 
    445338typedef void ( PopupFunc )( GtkWidget*, GdkEventButton* );
    446339
Note: See TracChangeset for help on using the changeset viewer.