From 0646e115fd635e0b96739ea39e65c0ef78ffaa30 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Sat, 26 Dec 2015 20:25:45 -0500 Subject: Fix numerous warnings/errors --- src/json.c | 2 +- src/main.c | 4 ++-- src/remote-exec.c | 3 ++- src/torrent-cell-renderer.c | 12 ++++++------ src/trg-client.c | 14 ++------------ src/trg-destination-combo.c | 4 ++-- src/trg-files-model.c | 2 +- src/trg-files-tree-view-common.c | 16 ++++------------ src/trg-icons.c | 1 + src/trg-json-widgets.c | 10 ---------- src/trg-main-window.c | 4 ++-- src/trg-model.c | 3 ++- src/trg-peers-model.c | 4 ++-- src/trg-peers-model.h | 2 +- src/trg-preferences-dialog.c | 2 +- src/trg-prefs.c | 4 ++-- src/trg-state-selector.c | 4 ++-- src/trg-status-bar.h | 2 +- src/trg-toolbar.c | 2 +- src/trg-torrent-add-dialog.c | 5 ++--- src/trg-torrent-model.c | 4 ++-- src/trg-torrent-model.h | 2 +- src/util.c | 2 +- src/util.h | 2 +- 24 files changed, 42 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/json.c b/src/json.c index fdce0b6..61dcb8f 100644 --- a/src/json.c +++ b/src/json.c @@ -100,7 +100,7 @@ gdouble json_double_to_progress(JsonNode * n) gdouble json_node_really_get_double(JsonNode * node) { - GValue a = { 0 }; + GValue a = G_VALUE_INIT; json_node_get_value(node, &a); switch (G_VALUE_TYPE(&a)) { diff --git a/src/main.c b/src/main.c index 4f5058e..fbf3a66 100644 --- a/src/main.c +++ b/src/main.c @@ -113,13 +113,13 @@ trg_simple_init(TrgClient * client, int argc, char *argv[], gchar ** args) /* Win32 mailslots. I've implemented this in win32-mailslot.c */ #if !WIN32 -static void trg_non_win32_init() +static void trg_non_win32_init(void) { bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); } #endif -static void trg_cleanup() +static void trg_cleanup(void) { curl_global_cleanup(); } diff --git a/src/remote-exec.c b/src/remote-exec.c index edf75f2..00e47fa 100644 --- a/src/remote-exec.c +++ b/src/remote-exec.c @@ -26,6 +26,7 @@ #include "trg-prefs.h" #include "protocol-constants.h" #include "torrent.h" +#include "remote-exec.h" /* A few functions used to build local commands, otherwise known as actions. * @@ -53,7 +54,7 @@ static const char json_exceptions[] = { 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, static gchar *dump_json_value(JsonNode * node) { - GValue value = { 0, }; + GValue value = G_VALUE_INIT; GString *buffer; buffer = g_string_new(""); diff --git a/src/torrent-cell-renderer.c b/src/torrent-cell-renderer.c index d8ea50b..632d418 100644 --- a/src/torrent-cell-renderer.c +++ b/src/torrent-cell-renderer.c @@ -322,16 +322,16 @@ static void getStatusString(GString * gstr, TorrentCellRenderer * r) if (priv->fileCount > 0) { g_string_append_printf(gstr, ngettext - ("Downloading from %1$lli of %2$lli connected peer", - "Downloading from %1$lli of %2$lli connected peers", + ("Downloading from %1$"G_GUINT64_FORMAT" of %2$"G_GUINT64_FORMAT" connected peer", + "Downloading from %1$"G_GUINT64_FORMAT" of %2$"G_GUINT64_FORMAT" connected peers", priv->webSeedsToUs + priv->peersToUs), priv->webSeedsToUs + priv->peersToUs, priv->webSeedsToUs + priv->connected); } else { g_string_append_printf(gstr, ngettext - ("Downloading metadata from %1$lli peer (%2$s done)", - "Downloading metadata from %1$lli peers (%2$s done)", + ("Downloading metadata from %1$"G_GUINT64_FORMAT" peer (%2$s done)", + "Downloading metadata from %1$"G_GUINT64_FORMAT" peers (%2$s done)", priv->connected + priv->webSeedsToUs), priv->connected + priv->webSeedsToUs, tr_strlpercent(buf, @@ -341,8 +341,8 @@ static void getStatusString(GString * gstr, TorrentCellRenderer * r) } else if (priv->flags & TORRENT_FLAG_SEEDING) { g_string_append_printf(gstr, ngettext - ("Seeding to %1$lli of %2$lli connected peer", - "Seeding to %1$lli of %2$lli connected peers", + ("Seeding to %1$"G_GUINT64_FORMAT" of %2$"G_GUINT64_FORMAT" connected peer", + "Seeding to %1$"G_GUINT64_FORMAT" of %2$"G_GUINT64_FORMAT" connected peers", priv->connected), priv->peersFromUs, priv->connected); } diff --git a/src/trg-client.c b/src/trg-client.c index d69ee24..5f6b6f9 100644 --- a/src/trg-client.c +++ b/src/trg-client.c @@ -490,7 +490,7 @@ header_callback(void *ptr, size_t size, size_t nmemb, void *data) return (nmemb * size); } -trg_tls *trg_tls_new(TrgClient * tc) +static trg_tls *trg_tls_new(TrgClient * tc) { trg_tls *tls = g_new0(trg_tls, 1); @@ -627,7 +627,7 @@ int trg_http_perform(TrgClient * tc, trg_request *request, trg_response * rsp) return trg_http_perform_inner(tc, request, rsp, TRUE); } -void trg_request_free(trg_request *req) { +static void trg_request_free(trg_request *req) { g_free(req->body); g_free(req->url); g_free(req->cookie); @@ -771,16 +771,6 @@ dispatch_async(TrgClient * tc, JsonNode * req, return dispatch_async_common(tc, trg_req, callback, data); } -gboolean -dispatch_async_str(TrgClient * tc, gchar * body, - GSourceFunc callback, gpointer data) -{ - trg_request *trg_req = g_new0(trg_request, 1); - trg_req->body = body; - - return dispatch_async_common(tc, trg_req, callback, data); -} - gboolean async_http_request(TrgClient *tc, gchar *url, const gchar *cookie, GSourceFunc callback, gpointer data) { trg_request *trg_req = g_new0(trg_request, 1); trg_req->url = g_strdup(url); diff --git a/src/trg-destination-combo.c b/src/trg-destination-combo.c index f7fc2f0..2b5814e 100644 --- a/src/trg-destination-combo.c +++ b/src/trg-destination-combo.c @@ -147,7 +147,7 @@ gtk_combo_box_entry_active_changed(GtkComboBox * combo_box, (combo_box)); if (entry) { - GValue value = { 0, }; + GValue value = G_VALUE_INIT; guint type; model = gtk_combo_box_get_model(combo_box); @@ -205,7 +205,7 @@ struct findDupeArg { gboolean isDupe; }; -gboolean +static gboolean trg_destination_combo_insert_check_dupe_foreach(GtkTreeModel * model, GtkTreePath * path G_GNUC_UNUSED, diff --git a/src/trg-files-model.c b/src/trg-files-model.c index bb1b46b..ac1fa20 100644 --- a/src/trg-files-model.c +++ b/src/trg-files-model.c @@ -299,7 +299,7 @@ struct MinorUpdateData { JsonArray *wanted; }; -gboolean +static gboolean trg_files_model_update_foreach(GtkListStore * model, GtkTreePath * path G_GNUC_UNUSED, GtkTreeIter * iter, gpointer data) diff --git a/src/trg-files-tree-view-common.c b/src/trg-files-tree-view-common.c index 4680d5f..b581959 100644 --- a/src/trg-files-tree-view-common.c +++ b/src/trg-files-tree-view-common.c @@ -62,31 +62,23 @@ view_popup_menu(GtkWidget * treeview, GdkEventButton * event, gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); - menuitem = gtk_image_menu_item_new_with_label(GTK_STOCK_APPLY); - gtk_image_menu_item_set_use_stock(GTK_IMAGE_MENU_ITEM(menuitem), TRUE); - gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM - (menuitem), TRUE); - gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), _("Download")); + menuitem = gtk_menu_item_new_with_label(_("Download")); g_signal_connect(menuitem, "activate", wanted_cb, treeview); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_image_menu_item_new_with_label(GTK_STOCK_CANCEL); - gtk_image_menu_item_set_use_stock(GTK_IMAGE_MENU_ITEM(menuitem), TRUE); - gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM - (menuitem), TRUE); - gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), _("Skip")); + menuitem = gtk_menu_item_new_with_label(_("Skip")); g_signal_connect(menuitem, "activate", unwanted_cb, treeview); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); - menuitem = gtk_image_menu_item_new_with_label(_("Expand All")); + menuitem = gtk_menu_item_new_with_label(_("Expand All")); g_signal_connect(menuitem, "activate", G_CALLBACK(expand_all_cb), treeview); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_image_menu_item_new_with_label(_("Collapse All")); + menuitem = gtk_menu_item_new_with_label(_("Collapse All")); g_signal_connect(menuitem, "activate", G_CALLBACK(collapse_all_cb), treeview); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); diff --git a/src/trg-icons.c b/src/trg-icons.c index efa45a7..ba36264 100644 --- a/src/trg-icons.c +++ b/src/trg-icons.c @@ -19,6 +19,7 @@ #include +#include "trg-icons.h" #include "icon-turtle.h" typedef struct { diff --git a/src/trg-json-widgets.c b/src/trg-json-widgets.c index abca7e1..0ba09f6 100644 --- a/src/trg-json-widgets.c +++ b/src/trg-json-widgets.c @@ -117,16 +117,6 @@ GtkWidget *trg_json_widget_entry_new(GList ** wl, JsonObject * obj, return w; } -void -trg_json_widget_time_save(GtkWidget * widget, JsonObject * obj, - gchar * key) -{ - - json_object_set_double_member(obj, key, - gtk_spin_button_get_value(GTK_SPIN_BUTTON - (widget))); -} - GtkWidget *trg_json_widget_spin_new(GList ** wl, JsonObject * obj, const gchar * key, GtkWidget * toggleDep, gdouble min, diff --git a/src/trg-main-window.c b/src/trg-main-window.c index 90da96c..65556ae 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -2539,9 +2539,9 @@ void trg_main_window_add_status_icon(TrgMainWindow * win) { TrgMainWindowPrivate *priv = win->priv; #ifdef HAVE_LIBAPPINDICATOR - if (priv->appIndicator = + if ((priv->appIndicator = app_indicator_new(PACKAGE_NAME, PACKAGE_NAME, - APP_INDICATOR_CATEGORY_APPLICATION_STATUS)) + APP_INDICATOR_CATEGORY_APPLICATION_STATUS))) { app_indicator_set_status(priv->appIndicator, APP_INDICATOR_STATUS_ACTIVE); diff --git a/src/trg-model.c b/src/trg-model.c index fa67d08..2e1ae28 100644 --- a/src/trg-model.c +++ b/src/trg-model.c @@ -20,6 +20,7 @@ #include #include #include +#include "trg-model.h" /* An extension of GtkListStore which provides some functions for looking up * an entry by ID. Also for removing entries which have an old update serial, @@ -32,7 +33,7 @@ struct trg_model_remove_removed_foreachfunc_args { GList *toRemove; }; -gboolean +static gboolean trg_model_remove_removed_foreachfunc(GtkTreeModel * model, GtkTreePath * path G_GNUC_UNUSED, GtkTreeIter * iter, gpointer data) diff --git a/src/trg-peers-model.c b/src/trg-peers-model.c index f46a083..d8e42ed 100644 --- a/src/trg-peers-model.c +++ b/src/trg-peers-model.c @@ -59,7 +59,7 @@ static void trg_peers_model_class_init(TrgPeersModelClass * #endif } -gboolean +static gboolean find_existing_peer_item_foreachfunc(GtkTreeModel * model, GtkTreePath * path G_GNUC_UNUSED, @@ -80,7 +80,7 @@ find_existing_peer_item_foreachfunc(GtkTreeModel * model, return pi->found; } -gboolean +static gboolean find_existing_peer_item(TrgPeersModel * model, JsonObject * p, GtkTreeIter * iter) { diff --git a/src/trg-peers-model.h b/src/trg-peers-model.h index 4995ab0..8d6b76c 100644 --- a/src/trg-peers-model.h +++ b/src/trg-peers-model.h @@ -56,7 +56,7 @@ typedef struct { GType trg_peers_model_get_type(void); -TrgPeersModel *trg_peers_model_new(); +TrgPeersModel *trg_peers_model_new(void); G_END_DECLS struct peerAndIter { const gchar *ip; diff --git a/src/trg-preferences-dialog.c b/src/trg-preferences-dialog.c index 71090d5..a58bd67 100644 --- a/src/trg-preferences-dialog.c +++ b/src/trg-preferences-dialog.c @@ -859,7 +859,7 @@ static GtkWidget *trg_prefs_serverPage(TrgPreferencesDialog * dlg) NULL); hig_workarea_add_wide_control(t, &row, w); w = trgp_check_new(dlg, _("Validate SSL Certificate"), TRG_PREFS_KEY_SSL_VALIDATE, TRG_PREFS_PROFILE, - w); + GTK_TOGGLE_BUTTON(w)); hig_workarea_add_wide_control(t, &row, w); #endif diff --git a/src/trg-prefs.c b/src/trg-prefs.c index 811c575..643e2a1 100644 --- a/src/trg-prefs.c +++ b/src/trg-prefs.c @@ -172,7 +172,7 @@ TrgPrefs *trg_prefs_new(void) return g_object_new(TRG_TYPE_PREFS, NULL); } -static JsonObject *trg_prefs_new_profile_object() +static JsonObject *trg_prefs_new_profile_object(void) { return json_object_new(); } @@ -493,7 +493,7 @@ JsonObject *trg_prefs_get_root(TrgPrefs * p) return priv->userObj; } -void trg_prefs_empty_init(TrgPrefs * p) +static void trg_prefs_empty_init(TrgPrefs * p) { TrgPrefsPrivate *priv = p->priv; JsonArray *profiles = json_array_new(); diff --git a/src/trg-state-selector.c b/src/trg-state-selector.c index cee0c56..919078c 100644 --- a/src/trg-state-selector.c +++ b/src/trg-state-selector.c @@ -163,7 +163,7 @@ trg_state_selector_update_dynamic_filter(GtkTreeModel * model, GtkTreeIter iter; GtkTreePath *path = gtk_tree_row_reference_get_path(rr); gint64 oldSerial; - GValue gvalue = { 0 }; + GValue gvalue = G_VALUE_INIT; gint oldCount; gtk_tree_model_get_iter(model, &iter, path); @@ -511,7 +511,7 @@ static void trg_state_selector_update_stat(GtkTreeRowReference * rr, gint count) { if (rr) { - GValue gvalue = { 0 }; + GValue gvalue = G_VALUE_INIT; GtkTreeIter iter; GtkTreePath *path = gtk_tree_row_reference_get_path(rr); GtkTreeModel *model = gtk_tree_row_reference_get_model(rr); diff --git a/src/trg-status-bar.h b/src/trg-status-bar.h index b4942ee..a5edfe8 100644 --- a/src/trg-status-bar.h +++ b/src/trg-status-bar.h @@ -47,7 +47,7 @@ typedef struct { GType trg_status_bar_get_type(void); -TrgStatusBar *trg_status_bar_new(); +TrgStatusBar *trg_status_bar_new(TrgMainWindow * win, TrgClient * client); G_END_DECLS void trg_status_bar_update(TrgStatusBar * sb, diff --git a/src/trg-toolbar.c b/src/trg-toolbar.c index 8d9ae1f..9764a2e 100644 --- a/src/trg-toolbar.c +++ b/src/trg-toolbar.c @@ -143,7 +143,7 @@ trg_toolbar_install_widget_prop(GObjectClass * class, guint propId, G_PARAM_STATIC_BLURB)); } -GtkWidget *trg_toolbar_item_new(TrgToolbar * toolbar, +static GtkWidget *trg_toolbar_item_new(TrgToolbar * toolbar, gchar * text, int *index, gchar * icon, gboolean sensitive) diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c index 9058757..37e4da0 100644 --- a/src/trg-torrent-add-dialog.c +++ b/src/trg-torrent-add-dialog.c @@ -238,7 +238,7 @@ onViewButtonPressed(GtkWidget * w, GdkEventButton * event, gpointer gdata) (set_unwanted), gdata); } -GtkWidget *gtr_file_list_new(GtkTreeStore ** store) +static GtkWidget *gtr_file_list_new(GtkTreeStore ** store) { int size; int width; @@ -256,7 +256,6 @@ GtkWidget *gtr_file_list_new(GtkTreeStore ** store) /* create the view */ view = gtk_tree_view_new(); tree_view = GTK_TREE_VIEW(view); - gtk_tree_view_set_rules_hint(tree_view, TRUE); gtk_container_set_border_width(GTK_CONTAINER(view), GUI_PAD_BIG); g_signal_connect(view, "button-press-event", G_CALLBACK(onViewButtonPressed), view); @@ -374,7 +373,7 @@ static void gtr_dialog_set_content(GtkDialog * dialog, GtkWidget * content) gtk_widget_show_all(content); } -GtkWidget *gtr_priority_combo_new(void) +static GtkWidget *gtr_priority_combo_new(void) { return gtr_combo_box_new_enum(_("Low"), TR_PRI_LOW, _("Normal"), TR_PRI_NORMAL, _("High"), TR_PRI_HIGH, diff --git a/src/trg-torrent-model.c b/src/trg-torrent-model.c index 676ed0e..232ea25 100644 --- a/src/trg-torrent-model.c +++ b/src/trg-torrent-model.c @@ -671,7 +671,7 @@ GHashTable *get_torrent_table(TrgTorrentModel * model) return priv->ht; } -gboolean +static gboolean trg_model_find_removed_foreachfunc(GtkTreeModel * model, GtkTreePath * path G_GNUC_UNUSED, @@ -692,7 +692,7 @@ trg_model_find_removed_foreachfunc(GtkTreeModel * model, return FALSE; } -GList *trg_torrent_model_find_removed(GtkTreeModel * model, +static GList *trg_torrent_model_find_removed(GtkTreeModel * model, gint64 currentSerial) { struct TrgModelRemoveData args; diff --git a/src/trg-torrent-model.h b/src/trg-torrent-model.h index 078afe8..4f17a8c 100644 --- a/src/trg-torrent-model.h +++ b/src/trg-torrent-model.h @@ -74,7 +74,7 @@ typedef struct { GType trg_torrent_model_get_type(void); -TrgTorrentModel *trg_torrent_model_new(); +TrgTorrentModel *trg_torrent_model_new(void); G_END_DECLS gboolean diff --git a/src/util.c b/src/util.c index 8dcbb65..3e13108 100644 --- a/src/util.c +++ b/src/util.c @@ -640,7 +640,7 @@ gchar *trg_win32_support_path(gchar * file) } #endif -gboolean is_unity() +gboolean is_unity(void) { return g_strcmp0(g_getenv("XDG_CURRENT_DESKTOP"), "Unity") == 0; } diff --git a/src/util.h b/src/util.h index 8134952..e7f4c07 100644 --- a/src/util.h +++ b/src/util.h @@ -98,7 +98,7 @@ gboolean should_be_minimised(int argc, char *argv[]); gboolean is_minimised_arg(const gchar * arg); GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing); GtkWidget *trg_hbox_new(gboolean homogeneous, gint spacing); -gboolean is_unity(); +gboolean is_unity(void); #ifdef WIN32 gchar *trg_win32_support_path(gchar * file); -- cgit v1.2.3