Changeset 804


Ignore:
Timestamp:
Aug 20, 2006, 10:45:29 PM (15 years ago)
Author:
joshe
Message:

Add a debug output window.

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r795 r804  
    188188        CFLAGS_GTK=`pkg-config gtk+-2.0 --cflags`
    189189        LDFLAGS_GTK=`pkg-config gtk+-2.0 --libs`
     190        if runcmd pkg-config gthread-2.0
     191        then
     192          CFLAGS_GTK="$CFLAGS_GTK `pkg-config gthread-2.0 --cflags`"
     193          LDFLAGS_GTK="$LDFLAGS_GTK `pkg-config gthread-2.0 --libs`"
     194        fi
    190195        if gettext_test
    191196        then
  • trunk/gtk/conf.h

    r760 r804  
    5959#define PREF_ADDSTD             "add-behavior-standard"
    6060#define PREF_ADDIPC             "add-behavior-ipc"
     61#define PREF_MSGLEVEL           "message-level"
    6162
    6263#endif /* TG_CONF_H */
  • trunk/gtk/dialogs.c

    r760 r804  
    6060
    6161static void
    62 windclosed(GtkWidget *widget SHUTUP, gpointer gdata);
    63 static void
    6462clicklimitbox(GtkWidget *widget, gpointer gdata);
    6563static void
     
    166164}
    167165
    168 void
    169 makeprefwindow(GtkWindow *parent, TrBackend *back, gboolean *opened) {
     166GtkWidget *
     167makeprefwindow(GtkWindow *parent, TrBackend *back) {
    170168  char *title = g_strdup_printf(_("%s Preferences"), g_get_application_name());
    171169  GtkWidget *wind = gtk_dialog_new_with_buttons(title, parent,
     
    200198  GtkCellRenderer *rend;
    201199
    202   *opened = TRUE;
    203 
    204200  g_free(title);
    205201  gtk_widget_set_name(wind, "TransmissionDialog");
     
    303299  g_signal_connect_data(wind, "response", G_CALLBACK(clickdialog),
    304300                        data, freedata, 0);
    305   g_signal_connect(wind, "destroy", G_CALLBACK(windclosed), opened);
    306301  gtk_widget_show_all(wind);
    307 }
    308 
    309 static void
    310 windclosed(GtkWidget *widget SHUTUP, gpointer gdata) {
    311   gboolean *preachy_gcc = gdata;
    312  
    313   *preachy_gcc = FALSE;
     302
     303  return wind;
    314304}
    315305
  • trunk/gtk/dialogs.h

    r760 r804  
    3030#include "util.h"
    3131
    32 void
    33 makeprefwindow(GtkWindow *parent, TrBackend *back, gboolean *opened);
     32GtkWidget *
     33makeprefwindow(GtkWindow *parent, TrBackend *back);
    3434
    3535/* set the upload limit based on saved prefs */
  • trunk/gtk/main.c

    r760 r804  
    3939#include "dialogs.h"
    4040#include "ipc.h"
     41#include "msgwin.h"
    4142#include "tr_backend.h"
    4243#include "tr_torrent.h"
     
    6364  guint timer;
    6465  gboolean prefsopen;
     66  gboolean msgwinopen;
    6567  GtkWidget *stupidpopuphack;
    6668  gboolean closing;
     
    113115dopopupmenu(GdkEventButton *event, struct cbdata *data);
    114116void
     117boolwindclosed(GtkWidget *widget SHUTUP, gpointer gdata);
     118void
    115119actionclick(GtkWidget *widget, gpointer gdata);
    116120gint
     
    139143
    140144#define LIST_ACTION           "torrent-list-action"
    141 enum listact { ACT_OPEN, ACT_START, ACT_STOP, ACT_DELETE, ACT_INFO, ACT_PREF };
     145enum listact {
     146  ACT_OPEN, ACT_START, ACT_STOP, ACT_DELETE, ACT_INFO, ACT_PREF, ACT_DEBUG };
    142147
    143148struct { const gchar *name; const gchar *id; enum listact act; gboolean nomenu;
     
    158163  {N_("Preferences"), GTK_STOCK_PREFERENCES,  ACT_PREF,   TRUE,   0,
    159164   N_("Customize application behavior"), "XXX"},
     165  {N_("Open debug window"), NULL, ACT_DEBUG,  FALSE,  0, NULL, NULL},
    160166};
    161167
     
    178184
    179185  safepipe();
     186  msgwin_init();
    180187
    181188  argfiles = readargs(argc, argv);
     
    222229        g_free(err);
    223230      }
     231
     232      /* set libT message level */
     233      msgwin_loadpref();
    224234
    225235      back = tr_backend_new();
     
    314324  data->buttons = NULL;
    315325  data->prefsopen = FALSE;
     326  data->msgwinopen = FALSE;
    316327  data->stupidpopuphack = NULL;
    317328  data->closing = FALSE;
     
    393404
    394405  for(ii = 0; ii < ALEN(actionitems); ii++) {
     406    if( NULL == actionitems[ii].id ) {
     407      data->buttons[ii] = NULL;
     408      continue;
     409    }
    395410    item = gtk_tool_button_new_from_stock(actionitems[ii].id);
    396411    data->buttons[ii] = GTK_WIDGET(item);
     
    519534    edata->timer = g_timeout_add(EXIT_CHECK_INTERVAL, exitcheck, edata);
    520535    for(ii = 0; ii < ALEN(actionitems); ii++)
    521       gtk_widget_set_sensitive(data->buttons[ii], FALSE);
     536      if( NULL != data->buttons[ii] )
     537        gtk_widget_set_sensitive(data->buttons[ii], FALSE);
    522538    gtk_widget_set_sensitive(GTK_WIDGET(data->view), FALSE);
    523539  }
     
    821837    tr_backend_torrents_stopped(data->back);
    822838
     839  /* update the message window */
     840  msgwin_update();
     841
    823842  return TRUE;
    824843}
     
    906925
    907926void
     927boolwindclosed(GtkWidget *widget SHUTUP, gpointer gdata) {
     928  gboolean *preachy_gcc = gdata;
     929 
     930  *preachy_gcc = FALSE;
     931}
     932
     933void
    908934actionclick(GtkWidget *widget, gpointer gdata) {
    909935  struct cbdata *data = gdata;
     
    917943  unsigned int actoff, status;
    918944  gboolean changed;
     945  GtkWidget * win;
    919946
    920947  act = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), LIST_ACTION));
     
    925952      return;
    926953    case ACT_PREF:
    927       if(!data->prefsopen)
    928         makeprefwindow(data->wind, data->back, &data->prefsopen);
     954      if( !data->prefsopen ) {
     955        data->prefsopen = TRUE;
     956        win = makeprefwindow( data->wind, data->back );
     957        g_signal_connect( win, "destroy", G_CALLBACK( boolwindclosed ),
     958                          &data->prefsopen );
     959      }
     960      return;
     961    case ACT_DEBUG:
     962      if( !data->msgwinopen ) {
     963        data->msgwinopen = TRUE;
     964        win = msgwin_create();
     965        g_signal_connect( win, "destroy", G_CALLBACK( boolwindclosed ),
     966                          &data->msgwinopen );
     967      }
    929968      return;
    930969    case ACT_START:
     
    9811020          case ACT_OPEN:
    9821021          case ACT_PREF:
     1022          case ACT_DEBUG:
    9831023            break;
    9841024        }
  • trunk/mk/gtk.mk

    r759 r804  
    44include ../mk/common.mk
    55
    6 SRCS = conf.c dialogs.c io.c ipc.c main.c tr_backend.c tr_torrent.c \
     6SRCS = conf.c dialogs.c io.c ipc.c main.c msgwin.c tr_backend.c tr_torrent.c \
    77        tr_cell_renderer_progress.c util.c
    88OBJS = $(SRCS:%.c=%.o)
Note: See TracChangeset for help on using the changeset viewer.