mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
Update 2005-12-19
This commit is contained in:
parent
48d7816c11
commit
b5ff15ed70
4 changed files with 35 additions and 11 deletions
|
@ -107,6 +107,16 @@ gtk_cell_renderer_torrent_new(void) {
|
||||||
return g_object_new (GTK_TYPE_CELL_RENDERER_TORRENT, NULL);
|
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
|
static void
|
||||||
finalize(GObject *object) {
|
finalize(GObject *object) {
|
||||||
GtkCellRendererTorrent *tcell = GTK_CELL_RENDERER_TORRENT(object);
|
GtkCellRendererTorrent *tcell = GTK_CELL_RENDERER_TORRENT(object);
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct _GtkCellRendererTorrentClass
|
||||||
|
|
||||||
GType gtk_cell_renderer_torrent_get_type (void) G_GNUC_CONST;
|
GType gtk_cell_renderer_torrent_get_type (void) G_GNUC_CONST;
|
||||||
GtkCellRenderer* gtk_cell_renderer_torrent_new (void);
|
GtkCellRenderer* gtk_cell_renderer_torrent_new (void);
|
||||||
|
void gtk_cell_renderer_torrent_reset_style(GtkCellRendererTorrent *);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
14
gtk/main.c
14
gtk/main.c
|
@ -80,6 +80,8 @@ GtkWidget *
|
||||||
makewind_toolbar(struct cbdata *data);
|
makewind_toolbar(struct cbdata *data);
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
makewind_list(struct cbdata *data);
|
makewind_list(struct cbdata *data);
|
||||||
|
static void
|
||||||
|
stylekludge(GObject *obj, GParamSpec *spec, gpointer gdata);
|
||||||
void
|
void
|
||||||
fixbuttons(GtkTreeSelection *sel, gpointer gdata);
|
fixbuttons(GtkTreeSelection *sel, gpointer gdata);
|
||||||
void
|
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_column_set_cell_data_func(col, progrend, dfprog, NULL, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
|
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);
|
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
|
||||||
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
||||||
gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_SINGLE);
|
gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_SINGLE);
|
||||||
|
@ -450,6 +455,15 @@ makewind_list(struct cbdata *data) {
|
||||||
return view;
|
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 */
|
/* disable buttons the user shouldn't be able to click on */
|
||||||
void
|
void
|
||||||
fixbuttons(GtkTreeSelection *sel, gpointer gdata) {
|
fixbuttons(GtkTreeSelection *sel, gpointer gdata) {
|
||||||
|
|
21
gtk/prefs.c
21
gtk/prefs.c
|
@ -140,18 +140,21 @@ clickdialog(GtkWidget *widget, int resp, gpointer gdata) {
|
||||||
struct prefdata *data = gdata;
|
struct prefdata *data = gdata;
|
||||||
int intval;
|
int intval;
|
||||||
const char *strval;
|
const char *strval;
|
||||||
char *strnum;
|
char *strnum, *errstr;
|
||||||
gboolean boolval;
|
gboolean boolval;
|
||||||
|
|
||||||
if(GTK_RESPONSE_OK == resp) {
|
if(GTK_RESPONSE_OK == resp) {
|
||||||
/* check directory */
|
/* check directory */
|
||||||
strval = gtk_entry_get_text(data->dir);
|
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",
|
errmsg(data->parent, "Failed to create directory %s:\n%s",
|
||||||
strval, strerror(errno));
|
strval, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save dir pref */
|
||||||
|
cf_setpref(PREF_DIR, gtk_entry_get_text(data->dir), NULL);
|
||||||
|
|
||||||
/* save port pref */
|
/* save port pref */
|
||||||
strnum = g_strdup_printf("%i",
|
strnum = g_strdup_printf("%i",
|
||||||
gtk_spin_button_get_value_as_int(data->port));
|
gtk_spin_button_get_value_as_int(data->port));
|
||||||
|
@ -166,21 +169,17 @@ clickdialog(GtkWidget *widget, int resp, gpointer gdata) {
|
||||||
/* save limit pref */
|
/* save limit pref */
|
||||||
intval = gtk_spin_button_get_value_as_int(data->limit);
|
intval = gtk_spin_button_get_value_as_int(data->limit);
|
||||||
strnum = g_strdup_printf("%i", intval);
|
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
|
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()
|
to an error string, so do this for the last call to cf_setpref()
|
||||||
*/
|
*/
|
||||||
/* save dir pref */
|
if(!cf_setpref(PREF_LIMIT, strnum, &errstr)) {
|
||||||
if(!cf_setpref(PREF_DIR, gtk_entry_get_text(data->dir), &strnum)) {
|
errmsg(data->parent, "%s", errstr);
|
||||||
errmsg(data->parent, "%s", strnum);
|
|
||||||
g_free(strnum);
|
g_free(strnum);
|
||||||
return;
|
g_free(errstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setlimit(data->tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy(widget);
|
gtk_widget_destroy(widget);
|
||||||
|
|
Loading…
Reference in a new issue