1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 19:03:04 +00:00

Update 2005-12-19

This commit is contained in:
Eric Petit 2006-01-12 18:56:00 +00:00
parent 48d7816c11
commit b5ff15ed70
4 changed files with 35 additions and 11 deletions

View file

@ -107,6 +107,16 @@ gtk_cell_renderer_torrent_new(void) {
return g_object_new (GTK_TYPE_CELL_RENDERER_TORRENT, NULL);
}
/* XXX need to do this better somehow */
void
gtk_cell_renderer_torrent_reset_style(GtkCellRendererTorrent *tor) {
if(NULL != tor->priv->style) {
gtk_style_detach(tor->priv->style);
gtk_style_unref(tor->priv->style);
tor->priv->style = NULL;
}
}
static void
finalize(GObject *object) {
GtkCellRendererTorrent *tcell = GTK_CELL_RENDERER_TORRENT(object);

View file

@ -63,6 +63,7 @@ struct _GtkCellRendererTorrentClass
GType gtk_cell_renderer_torrent_get_type (void) G_GNUC_CONST;
GtkCellRenderer* gtk_cell_renderer_torrent_new (void);
void gtk_cell_renderer_torrent_reset_style(GtkCellRendererTorrent *);
G_END_DECLS

View file

@ -80,6 +80,8 @@ GtkWidget *
makewind_toolbar(struct cbdata *data);
GtkWidget *
makewind_list(struct cbdata *data);
static void
stylekludge(GObject *obj, GParamSpec *spec, gpointer gdata);
void
fixbuttons(GtkTreeSelection *sel, gpointer gdata);
void
@ -438,6 +440,9 @@ makewind_list(struct cbdata *data) {
gtk_tree_view_column_set_cell_data_func(col, progrend, dfprog, NULL, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
/* XXX this shouldn't be necessary */
g_signal_connect(view, "notify", G_CALLBACK(stylekludge), progrend);
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_SINGLE);
@ -450,6 +455,15 @@ makewind_list(struct cbdata *data) {
return view;
}
/* kludge to have the progress bars notice theme changes */
static void
stylekludge(GObject *obj, GParamSpec *spec, gpointer gdata) {
if(0 == strcmp("style", spec->name)) {
gtk_cell_renderer_torrent_reset_style(GTK_CELL_RENDERER_TORRENT(gdata));
gtk_widget_queue_draw(GTK_WIDGET(obj));
}
}
/* disable buttons the user shouldn't be able to click on */
void
fixbuttons(GtkTreeSelection *sel, gpointer gdata) {

View file

@ -140,18 +140,21 @@ clickdialog(GtkWidget *widget, int resp, gpointer gdata) {
struct prefdata *data = gdata;
int intval;
const char *strval;
char *strnum;
char *strnum, *errstr;
gboolean boolval;
if(GTK_RESPONSE_OK == resp) {
/* check directory */
strval = gtk_entry_get_text(data->dir);
if(!mkdir_p(strval, 0777)) {
if('\0' != strval[0] &&!mkdir_p(strval, 0777)) {
errmsg(data->parent, "Failed to create directory %s:\n%s",
strval, strerror(errno));
return;
}
/* save dir pref */
cf_setpref(PREF_DIR, gtk_entry_get_text(data->dir), NULL);
/* save port pref */
strnum = g_strdup_printf("%i",
gtk_spin_button_get_value_as_int(data->port));
@ -166,21 +169,17 @@ clickdialog(GtkWidget *widget, int resp, gpointer gdata) {
/* save limit pref */
intval = gtk_spin_button_get_value_as_int(data->limit);
strnum = g_strdup_printf("%i", intval);
cf_setpref(PREF_LIMIT, strnum, NULL);
g_free(strnum);
setlimit(data->tr);
/*
note that prefs aren't written to disk unless we pass a pointer
to an error string, so do this for the last call to cf_setpref()
*/
/* save dir pref */
if(!cf_setpref(PREF_DIR, gtk_entry_get_text(data->dir), &strnum)) {
errmsg(data->parent, "%s", strnum);
if(!cf_setpref(PREF_LIMIT, strnum, &errstr)) {
errmsg(data->parent, "%s", errstr);
g_free(strnum);
return;
g_free(errstr);
}
setlimit(data->tr);
}
gtk_widget_destroy(widget);