diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2011-02-14 19:37:19 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2011-02-14 19:37:19 +0000 |
commit | af90b3a34078f1ba5eb1c042ae9f8be1b7499aac (patch) | |
tree | 91d1c751c0817fb9d07248be0bdbd6fe1e675e65 | |
parent | 3f7785e670e09cfd75a77ccca8031fabc0d432ab (diff) |
commit the actual dialog this time, the move dialog too.
-rw-r--r-- | src/trg-stats-dialog.c | 370 | ||||
-rw-r--r-- | src/trg-stats-dialog.h | 56 | ||||
-rw-r--r-- | src/trg-torrent-move-dialog.c | 166 | ||||
-rw-r--r-- | src/trg-torrent-move-dialog.h | 57 |
4 files changed, 649 insertions, 0 deletions
diff --git a/src/trg-stats-dialog.c b/src/trg-stats-dialog.c new file mode 100644 index 0000000..4674215 --- /dev/null +++ b/src/trg-stats-dialog.c @@ -0,0 +1,370 @@ +/* + * transmission-remote-gtk - Transmission RPC client for GTK + * Copyright (C) 2010 Alan Fitton + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <gtk/gtk.h> +#include <json-glib/json-glib.h> +#include <curl/curl.h> + +#include "hig.h" +#include "dispatch.h" +#include "requests.h" +#include "json.h" +#include "util.h" +#include "trg-client.h" +#include "trg-stats-dialog.h" +#include "trg-main-window.h" +#include "trg-tree-view.h" + +enum { + STATCOL_STAT, + STATCOL_SESSION, + STATCOL_CUMULAT, + STATCOL_COLUMNS +}; + +enum { + PROP_0, + PROP_PARENT, + PROP_CLIENT +}; + +G_DEFINE_TYPE(TrgStatsDialog, trg_stats_dialog, GTK_TYPE_DIALOG) +#define TRG_STATS_DIALOG_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRG_TYPE_STATS_DIALOG, TrgStatsDialogPrivate)) +typedef struct _TrgStatsDialogPrivate TrgStatsDialogPrivate; + +struct _TrgStatsDialogPrivate { + trg_client *client; + TrgMainWindow *parent; + GtkWidget *tv; + GtkListStore *model; + GtkTreeRowReference *rr_up, *rr_down, *rr_files_added, + *rr_session_count, *rr_active; +}; + +static GObject *instance = NULL; +static gboolean trg_update_stats_timerfunc(gpointer data); +static void on_stats_reply(JsonObject * response, int status, + gpointer data); + +static void +trg_stats_dialog_get_property(GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } +} + +static void +trg_stats_dialog_set_property(GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + TrgStatsDialogPrivate *priv = TRG_STATS_DIALOG_GET_PRIVATE(object); + switch (property_id) { + case PROP_CLIENT: + priv->client = g_value_get_pointer(value); + break; + case PROP_PARENT: + priv->parent = g_value_get_object(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } +} + +/*static void +trg_stats_dialog_dispose (GObject *object) +{ + TrgStatsDialogPrivate *priv = TRG_STATS_DIALOG_GET_PRIVATE(object); + + G_OBJECT_CLASS (trg_stats_dialog_parent_class)->dispose (object); +}*/ + +static void +trg_stats_response_cb(GtkDialog * dlg, gint res_id, + gpointer data G_GNUC_UNUSED) +{ + gtk_widget_destroy(GTK_WIDGET(dlg)); + instance = NULL; +} + +static GtkTreeRowReference *stats_dialog_add_statistic(GtkListStore * + model, gchar * name) +{ + GtkTreeIter iter; + GtkTreePath *path; + GtkTreeRowReference *rr; + + gtk_list_store_append(model, &iter); + gtk_list_store_set(model, &iter, STATCOL_STAT, name, -1); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter); + rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(model), path); + + gtk_tree_path_free(path); + + return rr; +} + +static void update_statistic(GtkTreeRowReference * rr, gchar * session, + gchar * cumulat) +{ + GtkTreePath *path = gtk_tree_row_reference_get_path(rr); + GtkTreeModel *model = gtk_tree_row_reference_get_model(rr); + GtkTreeIter iter; + + gtk_tree_model_get_iter(model, &iter, path); + + gtk_list_store_set(GTK_LIST_STORE(model), &iter, STATCOL_SESSION, + session, STATCOL_CUMULAT, cumulat, -1); + + gtk_tree_path_free(path); +} + +static JsonObject *get_session_arg(JsonObject * args) +{ + return json_object_get_object_member(args, "current-stats"); +} + +static JsonObject *get_cumulat_arg(JsonObject * args) +{ + return json_object_get_object_member(args, "cumulative-stats"); +} + +static void update_int_stat(JsonObject * args, GtkTreeRowReference * rr, + gchar * jsonKey) +{ + gchar session_val[32]; + gchar cumulat_val[32]; + + g_snprintf(session_val, sizeof(session_val), "%ld", + json_object_get_int_member(get_session_arg(args), jsonKey)); + g_snprintf(cumulat_val, sizeof(cumulat_val), "%ld", + json_object_get_int_member(get_cumulat_arg(args), jsonKey)); + + update_statistic(rr, session_val, cumulat_val); +} + +static void update_size_stat(JsonObject * args, GtkTreeRowReference * rr, + gchar * jsonKey) +{ + gchar session_val[32]; + gchar cumulat_val[32]; + + trg_strlsize(cumulat_val, + json_object_get_int_member(get_cumulat_arg(args), + jsonKey)); + trg_strlsize(session_val, + json_object_get_int_member(get_session_arg(args), + jsonKey)); + + update_statistic(rr, session_val, cumulat_val); +} + +static void update_time_stat(JsonObject * args, GtkTreeRowReference * rr, + gchar * jsonKey) +{ + gchar session_val[32]; + gchar cumulat_val[32]; + + tr_strltime_long(session_val, + json_object_get_int_member(get_session_arg(args), + jsonKey), + sizeof(session_val)); + tr_strltime_long(cumulat_val, + json_object_get_int_member(get_cumulat_arg(args), + jsonKey), + sizeof(cumulat_val)); + + update_statistic(rr, session_val, cumulat_val); +} + +static void on_stats_reply(JsonObject * response, int status, + gpointer data) +{ + TrgStatsDialogPrivate *priv = TRG_STATS_DIALOG_GET_PRIVATE(data); + JsonObject *args; + + if (status == CURLE_OK) { + args = get_arguments(response); + + update_size_stat(args, priv->rr_up, "uploadedBytes"); + update_size_stat(args, priv->rr_down, "downloadedBytes"); + update_int_stat(args, priv->rr_files_added, "filesAdded"); + update_int_stat(args, priv->rr_session_count, "sessionCount"); + update_time_stat(args, priv->rr_active, "secondsActive"); + + if (priv->client->session != NULL) + g_timeout_add_seconds(5, trg_update_stats_timerfunc, data); + } else { + const gchar *msg = make_error_message(response, status); + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(data), + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, "%s", + msg); + gtk_window_set_title(GTK_WINDOW(dialog), "Error"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_free((gpointer) msg); + } + + response_unref(response); +} + +static gboolean trg_update_stats_timerfunc(gpointer data) +{ + TrgStatsDialogPrivate *priv; + + if (TRG_IS_STATS_DIALOG(data)) { + priv = TRG_STATS_DIALOG_GET_PRIVATE(data); + dispatch_async(priv->client, session_stats(), on_stats_reply, + data); + } + + return FALSE; +} + +static void trg_stats_add_column(GtkTreeView * tv, gint index, + gchar * title, gint width) +{ + GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); + GtkTreeViewColumn *column = + gtk_tree_view_column_new_with_attributes(title, renderer, + "text", index, NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width(column, width); + + gtk_tree_view_append_column(tv, column); +} + +static GObject *trg_stats_dialog_constructor(GType type, + guint + n_construct_properties, + GObjectConstructParam + * construct_params) +{ + GtkWidget *tv; + + GObject *obj = G_OBJECT_CLASS + (trg_stats_dialog_parent_class)->constructor(type, + n_construct_properties, + construct_params); + TrgStatsDialogPrivate *priv = TRG_STATS_DIALOG_GET_PRIVATE(obj); + + gtk_window_set_title(GTK_WINDOW(obj), "Statistics"); + gtk_window_set_transient_for(GTK_WINDOW(obj), + GTK_WINDOW(priv->parent)); + gtk_window_set_destroy_with_parent(GTK_WINDOW(obj), TRUE); + gtk_dialog_add_button(GTK_DIALOG(obj), GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE); + + gtk_container_set_border_width(GTK_CONTAINER(obj), GUI_PAD); + + gtk_dialog_set_default_response(GTK_DIALOG(obj), GTK_RESPONSE_CLOSE); + + g_signal_connect(G_OBJECT(obj), + "response", G_CALLBACK(trg_stats_response_cb), NULL); + + priv->model = + gtk_list_store_new(STATCOL_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING); + + priv->rr_down = + stats_dialog_add_statistic(priv->model, "Download Total"); + priv->rr_up = stats_dialog_add_statistic(priv->model, "Upload Total"); + priv->rr_files_added = + stats_dialog_add_statistic(priv->model, "Files Added"); + priv->rr_session_count = + stats_dialog_add_statistic(priv->model, "Session Count"); + priv->rr_active = + stats_dialog_add_statistic(priv->model, "Time Active"); + + tv = priv->tv = trg_tree_view_new(); + gtk_widget_set_sensitive(tv, TRUE); + + trg_stats_add_column(GTK_TREE_VIEW(tv), STATCOL_STAT, "Statistic", + 170); + trg_stats_add_column(GTK_TREE_VIEW(tv), STATCOL_SESSION, "Session", + 100); + trg_stats_add_column(GTK_TREE_VIEW(tv), STATCOL_CUMULAT, "Cumulative", + 100); + + gtk_tree_view_set_model(GTK_TREE_VIEW(tv), + GTK_TREE_MODEL(priv->model)); + + gtk_container_set_border_width(GTK_CONTAINER(tv), GUI_PAD); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), tv, TRUE, TRUE, 0); + gtk_window_set_default_size(GTK_WINDOW(obj), 400, 220); + + dispatch_async(priv->client, session_stats(), on_stats_reply, obj); + + return obj; +} + +static void trg_stats_dialog_class_init(TrgStatsDialogClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + g_type_class_add_private(klass, sizeof(TrgStatsDialogPrivate)); + + object_class->get_property = trg_stats_dialog_get_property; + object_class->set_property = trg_stats_dialog_set_property; + object_class->constructor = trg_stats_dialog_constructor; + + g_object_class_install_property(object_class, + PROP_PARENT, + g_param_spec_object + ("parent-window", "Parent window", + "Parent window", + TRG_TYPE_MAIN_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_NAME | + G_PARAM_STATIC_NICK | + G_PARAM_STATIC_BLURB)); + + g_object_class_install_property(object_class, + PROP_CLIENT, + g_param_spec_pointer + ("trg-client", "TClient", + "Client", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_NAME | + G_PARAM_STATIC_NICK | + G_PARAM_STATIC_BLURB)); +} + +static void trg_stats_dialog_init(TrgStatsDialog * self) +{ +} + +TrgStatsDialog *trg_stats_dialog_get_instance(TrgMainWindow * parent, + trg_client * client) +{ + if (instance == NULL) { + instance = g_object_new(TRG_TYPE_STATS_DIALOG, + "trg-client", client, + "parent-window", parent, NULL); + } + + return TRG_STATS_DIALOG(instance); +} diff --git a/src/trg-stats-dialog.h b/src/trg-stats-dialog.h new file mode 100644 index 0000000..0547467 --- /dev/null +++ b/src/trg-stats-dialog.h @@ -0,0 +1,56 @@ +/* + * transmission-remote-gtk - Transmission RPC client for GTK + * Copyright (C) 2010 Alan Fitton + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef TRG_STATS_DIALOG_H_ +#define TRG_STATS_DIALOG_H_ + +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "trg-client.h" +#include "trg-main-window.h" +#include "trg-tree-view.h" + +G_BEGIN_DECLS +#define TRG_TYPE_STATS_DIALOG trg_stats_dialog_get_type() +#define TRG_STATS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRG_TYPE_STATS_DIALOG, TrgStatsDialog)) +#define TRG_STATS_DIALOG_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), TRG_TYPE_STATS_DIALOG, TrgStatsDialogClass)) +#define TRG_IS_STATS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRG_TYPE_STATS_DIALOG)) +#define TRG_IS_STATS_DIALOG_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), TRG_TYPE_STATS_DIALOG)) +#define TRG_STATS_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TRG_TYPE_STATS_DIALOG, TrgStatsDialogClass)) + typedef struct { + GtkDialog parent; +} TrgStatsDialog; + +typedef struct { + GtkDialogClass parent_class; +} TrgStatsDialogClass; + +GType trg_stats_dialog_get_type(void); + +TrgStatsDialog *trg_stats_dialog_get_instance(TrgMainWindow * parent, + trg_client * client); + +G_END_DECLS +#endif /* TRG_STATS_DIALOG_H_ */ diff --git a/src/trg-torrent-move-dialog.c b/src/trg-torrent-move-dialog.c new file mode 100644 index 0000000..895b269 --- /dev/null +++ b/src/trg-torrent-move-dialog.c @@ -0,0 +1,166 @@ +/* + * transmission-remote-gtk - Transmission RPC client for GTK + * Copyright (C) 2011 Alan Fitton + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <gtk/gtk.h> +#include <json-glib/json-glib.h> + +#include "trg-client.h" +#include "trg-main-window.h" +#include "trg-torrent-move-dialog.h" +#include "hig.h" +#include "torrent.h" +#include "requests.h" +#include "dispatch.h" + +G_DEFINE_TYPE(TrgTorrentMoveDialog, trg_torrent_move_dialog, + GTK_TYPE_DIALOG) +#define TRG_TORRENT_MOVE_DIALOG_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRG_TYPE_TORRENT_MOVE_DIALOG, TrgTorrentMoveDialogPrivate)) +typedef struct _TrgTorrentMoveDialogPrivate + TrgTorrentMoveDialogPrivate; + +struct _TrgTorrentMoveDialogPrivate { + trg_client *client; + TrgMainWindow *win; + JsonArray *ids; + GtkWidget *location_combo, *move_check, *move_button; +}; + +static void +trg_torrent_move_dialog_class_init(TrgTorrentMoveDialogClass * klass) +{ + g_type_class_add_private(klass, sizeof(TrgTorrentMoveDialogPrivate)); +} + +static void +trg_torrent_move_response_cb(GtkDialog * dlg, gint res_id, gpointer data) +{ + TrgTorrentMoveDialogPrivate *priv = + TRG_TORRENT_MOVE_DIALOG_GET_PRIVATE(dlg); + if (res_id == GTK_RESPONSE_ACCEPT) { + gchar *location = + gtk_combo_box_get_active_text(GTK_COMBO_BOX + (priv->location_combo)); + JsonNode *request = torrent_set_location(priv->ids, location, + gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON + (priv->move_check))); + g_free(location); + dispatch_async(priv->client, request, + on_generic_interactive_action, data); + } else { + json_array_unref(priv->ids); + } + gtk_widget_destroy(GTK_WIDGET(dlg)); +} + +static void location_changed(GtkWidget * w, gpointer data) +{ + TrgTorrentMoveDialogPrivate *priv = + TRG_TORRENT_MOVE_DIALOG_GET_PRIVATE(data); + gchar *location = + gtk_combo_box_get_active_text(GTK_COMBO_BOX(priv->location_combo)); + gtk_widget_set_sensitive(priv->move_button, strlen(location) > 0); + g_free(location); +} + +static void trg_torrent_move_dialog_init(TrgTorrentMoveDialog * self) +{ + TrgTorrentMoveDialogPrivate *priv = + TRG_TORRENT_MOVE_DIALOG_GET_PRIVATE(self); + GtkWidget *w, *t; + gint row = 0; + + t = hig_workarea_create(); + + w = priv->location_combo = gtk_combo_box_entry_new_text(); + g_signal_connect(w, "changed", G_CALLBACK(location_changed), self); + w = hig_workarea_add_row(t, &row, "Location:", w, NULL); + + priv->move_check = + hig_workarea_add_wide_checkbutton(t, &row, "Move", TRUE); + + gtk_window_set_destroy_with_parent(GTK_WINDOW(self), TRUE); + + gtk_dialog_add_button(GTK_DIALOG(self), GTK_STOCK_CLOSE, + GTK_RESPONSE_CANCEL); + priv->move_button = + gtk_dialog_add_button(GTK_DIALOG(self), "Move", + GTK_RESPONSE_ACCEPT); + gtk_widget_set_sensitive(priv->move_button, FALSE); + + gtk_container_set_border_width(GTK_CONTAINER(self), GUI_PAD); + + gtk_dialog_set_default_response(GTK_DIALOG(self), GTK_RESPONSE_ACCEPT); + + gtk_dialog_set_alternative_button_order(GTK_DIALOG(self), + GTK_RESPONSE_ACCEPT, + GTK_RESPONSE_CANCEL, -1); + + gtk_container_set_border_width(GTK_CONTAINER(t), GUI_PAD); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(self)->vbox), t, TRUE, TRUE, 0); +} + +TrgTorrentMoveDialog *trg_torrent_move_dialog_new(TrgMainWindow * win, + trg_client * client, + TrgTorrentTreeView * ttv) +{ + GObject *obj = g_object_new(TRG_TYPE_TORRENT_MOVE_DIALOG, NULL); + TrgTorrentMoveDialogPrivate *priv = + TRG_TORRENT_MOVE_DIALOG_GET_PRIVATE(obj); + + gint count; + gchar *msg; + + priv->client = client; + priv->win = win; + priv->ids = build_json_id_array(ttv); + + count = + gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection + (GTK_TREE_VIEW(ttv))); + + if (count == 1) { + GtkTreeIter iter; + JsonObject *json; + gchar *name; + const gchar *current_location; + get_first_selected(client, ttv, &iter, &json); + gtk_tree_model_get(gtk_tree_view_get_model(GTK_TREE_VIEW(ttv)), + &iter, TORRENT_COLUMN_NAME, &name, -1); + current_location = torrent_get_download_dir(json); + gtk_combo_box_append_text(GTK_COMBO_BOX(priv->location_combo), + current_location); + gtk_combo_box_set_active(GTK_COMBO_BOX(priv->location_combo), 0); + msg = g_strdup_printf("Move %s", name); + g_free(name); + } else { + msg = g_strdup_printf("Move %d torrents", count); + } + + gtk_window_set_transient_for(GTK_WINDOW(obj), GTK_WINDOW(win)); + gtk_window_set_title(GTK_WINDOW(obj), msg); + + g_signal_connect(G_OBJECT(obj), + "response", + G_CALLBACK(trg_torrent_move_response_cb), win); + + return TRG_TORRENT_MOVE_DIALOG(obj); +} diff --git a/src/trg-torrent-move-dialog.h b/src/trg-torrent-move-dialog.h new file mode 100644 index 0000000..3791b1d --- /dev/null +++ b/src/trg-torrent-move-dialog.h @@ -0,0 +1,57 @@ +/* + * transmission-remote-gtk - Transmission RPC client for GTK + * Copyright (C) 2011 Alan Fitton + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef TRG_TORRENT_MOVE_DIALOG_H_ +#define TRG_TORRENT_MOVE_DIALOG_H_ + +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "trg-client.h" +#include "trg-main-window.h" + +G_BEGIN_DECLS +#define TRG_TYPE_TORRENT_MOVE_DIALOG trg_torrent_move_dialog_get_type() +#define TRG_TORRENT_MOVE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRG_TYPE_TORRENT_MOVE_DIALOG, TrgTorrentMoveDialog)) +#define TRG_TORRENT_MOVE_DIALOG_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), TRG_TYPE_TORRENT_MOVE_DIALOG, TrgTorrentMoveDialogClass)) +#define TRG_IS_TORRENT_MOVE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRG_TYPE_TORRENT_MOVE_DIALOG)) +#define TRG_IS_TORRENT_MOVE_DIALOG_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), TRG_TYPE_TORRENT_MOVE_DIALOG)) +#define TRG_TORRENT_MOVE_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TRG_TYPE_TORRENT_MOVE_DIALOG, TrgTorrentMoveDialogClass)) + typedef struct { + GtkDialog parent; +} TrgTorrentMoveDialog; + +typedef struct { + GtkDialogClass parent_class; +} TrgTorrentMoveDialogClass; + +GType trg_torrent_move_dialog_get_type(void); + +TrgTorrentMoveDialog *trg_torrent_move_dialog_new(TrgMainWindow * win, + trg_client * client, + TrgTorrentTreeView * + ttv); + +G_END_DECLS +#endif /* TRG_TORRENT_MOVE_DIALOG_H_ */ |