file-browser-messages: Clean up formatting

This commit is contained in:
JosephMcc 2017-02-13 15:02:25 -08:00
parent 372399891d
commit fe9e6ac91c
1 changed files with 263 additions and 249 deletions

View File

@ -92,7 +92,9 @@ window_data_free (XedWindow *window)
gtk_ui_manager_remove_action_group (manager, data->merged_actions);
for (item = data->merge_ids; item; item = item->next)
{
gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data));
}
g_list_free (data->merge_ids);
g_object_unref (data->merged_actions);
@ -115,10 +117,8 @@ filter_data_new (XedWindow *window,
wdata = get_window_data (window);
g_hash_table_insert (wdata->filters,
xed_message_type_identifier (xed_message_get_object_path (message),
xed_message_get_method (message)),
data);
g_hash_table_insert (wdata->filters, xed_message_type_identifier (xed_message_get_object_path (message),
xed_message_get_method (message)), data);
return data;
}
@ -148,7 +148,9 @@ track_row_lookup (WindowData *data,
ref = (GtkTreeRowReference *)g_hash_table_lookup (data->row_tracking, id);
if (!ref)
{
return NULL;
}
return gtk_tree_row_reference_get_path (ref);
}
@ -201,16 +203,24 @@ message_set_root_cb (XedMessageBus *bus,
xed_message_get (message, "location", &root, NULL);
if (!root)
{
return;
}
if (xed_message_has_key (message, "virtual"))
{
xed_message_get (message, "virtual", &virtual, NULL);
}
if (virtual)
{
xed_file_browser_widget_set_root_and_virtual_root (data->widget, root, virtual);
}
else
{
xed_file_browser_widget_set_root (data->widget, root, TRUE);
}
}
static void
message_set_emblem_cb (XedMessageBus *bus,
@ -239,11 +249,7 @@ message_set_emblem_cb (XedMessageBus *bus,
GError *error = NULL;
GdkPixbuf *pixbuf;
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
emblem,
10,
0,
&error);
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), emblem, 10, 0, &error);
if (pixbuf)
{
@ -257,10 +263,7 @@ message_set_emblem_cb (XedMessageBus *bus,
g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf);
xed_file_browser_store_set_value (store,
&iter,
XED_FILE_BROWSER_STORE_COLUMN_EMBLEM,
&value);
xed_file_browser_store_set_value (store, &iter, XED_FILE_BROWSER_STORE_COLUMN_EMBLEM, &value);
g_value_unset (&value);
}
@ -330,23 +333,24 @@ set_item_message (WindowData *data,
-1);
if (!location)
{
return;
}
if (path && gtk_tree_path_get_depth (path) != 0)
{
track_id = track_row (data, store, path, location);
}
else
{
track_id = NULL;
}
xed_message_set (message,
"id", track_id,
"location", location,
NULL);
xed_message_set (message, "id", track_id, "location", location, NULL);
if (xed_message_has_key (message, "is_directory"))
{
xed_message_set (message,
"is_directory", FILE_IS_DIR (flags),
NULL);
xed_message_set (message, "is_directory", FILE_IS_DIR (flags), NULL);
}
g_free (track_id);
@ -399,10 +403,7 @@ message_add_filter_cb (XedMessageBus *bus,
FilterData *filter_data;
WindowData *data = get_window_data (window);
xed_message_get (message,
"object_path", &object_path,
"method", &method,
NULL);
xed_message_get (message, "object_path", &object_path, "method", &method, NULL);
// Check if there exists such a 'callback' message
if (!object_path || !method)
@ -459,7 +460,9 @@ message_remove_filter_cb (XedMessageBus *bus,
xed_message_get (message, "id", &id, NULL);
if (!id)
{
return;
}
xed_file_browser_widget_remove_filter (data->widget, id);
}
@ -513,9 +516,13 @@ message_set_show_hidden_cb (XedMessageBus *bus,
mode = xed_file_browser_store_get_filter_mode (store);
if (active)
{
mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
}
else
{
mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
}
xed_file_browser_store_set_filter_mode (store, mode);
}
@ -535,9 +542,13 @@ message_set_show_binary_cb (XedMessageBus *bus,
mode = xed_file_browser_store_get_filter_mode (store);
if (active)
{
mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY;
}
else
{
mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY;
}
xed_file_browser_store_set_filter_mode (store, mode);
}
@ -569,15 +580,14 @@ message_add_context_item_cb (XedMessageBus *bus,
GtkUIManager *manager;
guint merge_id;
xed_message_get (message,
"action", &action,
"path", &path,
NULL);
xed_message_get (message, "action", &action, "path", &path, NULL);
if (!action || !path)
{
if (action)
{
g_object_unref (action);
}
g_free (path);
return;
@ -622,7 +632,9 @@ message_remove_context_item_cb (XedMessageBus *bus,
xed_message_get (message, "id", &merge_id, NULL);
if (merge_id == 0)
{
return;
}
manager = xed_file_browser_widget_get_ui_manager (data->widget);
@ -778,7 +790,9 @@ store_row_deleted (XedFileBrowserStore *store,
guint flags = 0;
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
{
return;
}
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
@ -804,11 +818,11 @@ store_virtual_root_changed (XedFileBrowserStore *store,
vroot = xed_file_browser_store_get_virtual_root (store);
if (!vroot)
{
return;
}
xed_message_set (data->message,
"location", vroot,
NULL);
xed_message_set (data->message, "location", vroot, NULL);
xed_message_bus_send_message_sync (wdata->bus, data->message);
@ -981,7 +995,9 @@ message_unregistered (XedMessageBus *bus,
data = g_hash_table_lookup (wdata->filters, identifier);
if (data)
{
xed_file_browser_widget_remove_filter (wdata->widget, data->id);
}
g_free (identifier);
}
@ -995,10 +1011,8 @@ xed_file_browser_messages_register (XedWindow *window,
register_methods (window, widget);
register_signals (window, widget);
g_signal_connect (xed_window_get_message_bus (window),
"unregistered",
G_CALLBACK (message_unregistered),
window);
g_signal_connect (xed_window_get_message_bus (window), "unregistered",
G_CALLBACK (message_unregistered), window);
}
static void