~am-monkeyd/marlin/marlin-gtk2-test

« back to all changes in this revision

Viewing changes to src/fm-directory-view.c

  • Committer: am.monkeyd at gmail
  • Date: 2011-03-26 20:45:52 UTC
  • Revision ID: am.monkeyd@gmail.com-20110326204552-i24m2x53u34ht84s
listview: store get_selection

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
      FMDirectoryView *directory_view;
225
225
      } ApplicationLaunchParameters;*/
226
226
 
227
 
    /* Identifiers for DnD target types */
228
 
    enum
 
227
/* Identifiers for DnD target types */
 
228
enum
229
229
{
230
230
    TARGET_TEXT_URI_LIST,
231
231
    TARGET_XDND_DIRECT_SAVE0,
647
647
    gof_window_columns_add_preview(dview->details->slot, GTK_WIDGET (contextview));
648
648
}
649
649
 
 
650
#if 0
650
651
void
651
652
fm_directory_view_set_active_slot (FMDirectoryView *dview)
652
653
{
659
660
 
660
661
    log_printf (LOG_LEVEL_UNDEFINED, "!!!!!!!!!!! %s\n", G_STRFUNC);
661
662
}
 
663
#endif
662
664
 
663
665
void
664
666
fm_directory_view_load_location (FMDirectoryView *directory_view, GFile *location)
1590
1592
    GtkUIManager *ui_manager;
1591
1593
 
1592
1594
    g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
1593
 
    selection = fm_directory_view_get_selection_for_file_transfer (view);
 
1595
    selection = fm_directory_view_get_selection (view);
1594
1596
    //thunar_standard_view_merge_custom_actions (standard_view, selected_items);
1595
1597
    /*g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
1596
1598
    g_list_free (selected_items);*/
1597
 
    gof_file_list_free (selection);
1598
1599
   
1599
1600
    /* grab an additional reference on the view */
1600
1601
    g_object_ref (G_OBJECT (view));
1767
1768
        if (!(directory_view->details->loading && slot->directory->loaded))
1768
1769
            g_signal_connect (slot->directory, "file_loaded", G_CALLBACK (file_loaded_callback), directory_view);
1769
1770
        g_signal_connect (slot->directory, "file_added", G_CALLBACK (file_added_callback), directory_view);
 
1771
        //TODO
1770
1772
        //g_signal_connect (slot->directory, "file_changed", G_CALLBACK (file_changed_callback), directory_view);
1771
1773
        g_signal_connect (slot->directory, "file_deleted", G_CALLBACK (file_deleted_callback), directory_view);
1772
1774
        g_signal_connect (slot->directory, "done_loading", G_CALLBACK (directory_done_loading_callback), directory_view);
2036
2038
}
2037
2039
 
2038
2040
GList *
 
2041
fm_directory_view_get_selection (FMDirectoryView *view)
 
2042
{
 
2043
    g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
 
2044
 
 
2045
    return EEL_CALL_METHOD_WITH_RETURN_VALUE
 
2046
        (FM_DIRECTORY_VIEW_CLASS, view,
 
2047
         get_selection, (view));
 
2048
}
 
2049
 
 
2050
GList *
2039
2051
fm_directory_view_get_selection_for_file_transfer (FMDirectoryView *view)
2040
2052
{
2041
2053
    g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
2095
2107
    }
2096
2108
}
2097
2109
 
 
2110
static void
 
2111
new_folder_done (GFile *new_folder, gpointer user_data)
 
2112
{
 
2113
    //TODO
 
2114
    //rename_file (directory_view, file);
 
2115
    printf ("rename file\n");
 
2116
}
 
2117
 
 
2118
static void
 
2119
action_new_folder_callback (GtkAction *action, gpointer data)
 
2120
{                
 
2121
    FMDirectoryView *view;
 
2122
    
 
2123
    g_assert (FM_IS_DIRECTORY_VIEW (data));
 
2124
 
 
2125
    view = FM_DIRECTORY_VIEW (data);
 
2126
 
 
2127
    //data = new_folder_data_new (view);
 
2128
 
 
2129
        /*g_signal_connect_data (view,
 
2130
                           "add_file",
 
2131
                           G_CALLBACK (track_newly_added_locations),
 
2132
                           data,
 
2133
                           (GClosureNotify)NULL,
 
2134
                           G_CONNECT_AFTER);*/
 
2135
 
 
2136
    /* TODO usefull for desktop
 
2137
        pos = context_menu_to_file_operation_position (directory_view);*/
 
2138
 
 
2139
    printf ("%s\n", G_STRFUNC);
 
2140
        /*parent_uri = nautilus_view_get_backing_uri (directory_view);
 
2141
        marlin_file_operations_new_folder (GTK_WIDGET (view),
 
2142
                                       //pos, parent_uri,
 
2143
                                       NULL, parent_uri,
 
2144
                                       //new_folder_done, data);
 
2145
                                       new_folder_done, NULL);
 
2146
 
 
2147
        g_free (parent_uri);*/
 
2148
}
 
2149
 
 
2150
static void
 
2151
action_properties_callback (GtkAction *action, gpointer data)
 
2152
{
 
2153
    //TODO
 
2154
#if 0
 
2155
    FMDirectoryView *view;
 
2156
    GList *selection;
 
2157
    GList *files;
 
2158
        
 
2159
    g_assert (FM_DIRECTORY_IS_VIEW (callback_data));
 
2160
 
 
2161
    view = FM_DIRECTORY_VIEW (callback_data);
 
2162
    selection = nautilus_view_get_selection (view);
 
2163
    if (g_list_length (selection) == 0) {
 
2164
        if (view->details->directory_as_file != NULL) {
 
2165
                        files = g_list_append (NULL, nautilus_file_ref (view->details->directory_as_file));
 
2166
                        nautilus_properties_window_present (files, GTK_WIDGET (view));
 
2167
                        gof_file_list_free (files);
 
2168
                }
 
2169
        } else {
 
2170
                nautilus_properties_window_present (selection, GTK_WIDGET (view));
 
2171
        }
 
2172
    gof_file_list_free (selection);
 
2173
#endif
 
2174
}
 
2175
 
2098
2176
 
2099
2177
//TODO complete this list
2100
2178
static const GtkActionEntry directory_view_entries[] = {
2101
2179
    /* name, stock id */        { "Cut", GTK_STOCK_CUT,
2102
 
        /* label, accelerator */      NULL, NULL,
2103
 
        /* tooltip */                 N_("Prepare the selected files to be moved with a Paste command"),
2104
 
        G_CALLBACK (action_cut_files) },
 
2180
    /* label, accelerator */      NULL, NULL,
 
2181
    /* tooltip */                 N_("Prepare the selected files to be moved with a Paste command"),
 
2182
            G_CALLBACK (action_cut_files) },
2105
2183
    /* name, stock id */        { "Copy", GTK_STOCK_COPY,
2106
 
        /* label, accelerator */      NULL, NULL,
2107
 
        /* tooltip */                 N_("Prepare the selected files to be copied with a Paste command"),
2108
 
        G_CALLBACK (action_copy_files) },
 
2184
    /* label, accelerator */      NULL, NULL,
 
2185
    /* tooltip */                 N_("Prepare the selected files to be copied with a Paste command"),
 
2186
            G_CALLBACK (action_copy_files) },
2109
2187
    /* name, stock id */        { "Paste", GTK_STOCK_PASTE,
2110
 
        /* label, accelerator */      NULL, NULL,
2111
 
        /* tooltip */                 N_("Move or copy files previously selected by a Cut or Copy command"),
2112
 
        G_CALLBACK (action_paste_files) }
 
2188
    /* label, accelerator */      NULL, NULL,
 
2189
    /* tooltip */                 N_("Move or copy files previously selected by a Cut or Copy command"),
 
2190
            G_CALLBACK (action_paste_files) },
 
2191
    /* name, stock id */         { "New Folder", "folder-new",
 
2192
    /* label, accelerator */       N_("Create New _Folder"), "<control><shift>N",
 
2193
    /* tooltip */                  N_("Create a new empty folder inside this folder"),
 
2194
                G_CALLBACK (action_new_folder_callback) },
 
2195
    /* name, stock id */         { "Properties", GTK_STOCK_PROPERTIES,
 
2196
    /* label, accelerator */       N_("_Properties"), "<alt>Return",
 
2197
    /* tooltip */                  N_("View or modify the properties of each selected item"),
 
2198
                G_CALLBACK (action_properties_callback) }
 
2199
 
2113
2200
};
2114
2201
 
2115
2202