#267 Display image dimensions in status bar

closed-wont-fix
5
2014-01-06
2012-10-08
Alexander Varnin
No

It would be handy, if pcmanfm would show image dimensions in status bar, when you select it.
Probably, make it as option, so it can be disabled for perfomance.

Discussion

1 2 > >> (Page 1 of 2)
  • This feature isn't appropriate for lightweight file manager. I'm sorry.
    You can create a plugin to show that info in custom column though so you can see it.
    Thank you very much.

     
    • assigned_to: nobody --> lstranger
    • status: open --> closed-rejected
     
  • Do you mean plugin for pcmanfm or for libfm?
    I haven't found any plugin system related information about pcmanfm.
    I see modules directory in libfm sources, but, as far as i understand this modules getting compiled in libfm. Is it possible for module to be external?

     
    • status: closed-rejected --> open-rejected
     
    • status: open-rejected --> closed-rejected
     
  • LibFM 1.2.0 supports plugins for custom columns (icon-type views aren't customisable yet in 1.2.0 though, only Detailed List View is). Yes, built-in plugins are in the src/modules but you can build any of them outside of libfm sources tree. Compile it and install into right place is enough to make it available for libfm. The dummy columns plugin may be as simple as this:

    #include <libfm/fm-gtk.h>
    FM_DEFINE_MODULE(gtk_folder_col, dummy)
    static GType _get_type(void) { return G_TYPE_STRING; }
    static void _get_value(FmFileInfo *fi, GValue *value) { g_value_set_string(value, "---"); }
    FmFolderModelColumnInit fm_module_init_gtk_folder_col = {
    "Dummy",
    0,
    _get_type,
    _get_value,
    NULL
    };

     
  • Also, information about plugins is in the LibFM documentation, look for FmModule topic in the HTML docs.
    Thank you very much.

     
  • Sorry if I reopen bug report again. I don't know, how to post without reopening.
    Is it possible to modify contents of status bar from module?
    It is not very useful to make column in detailed list view with images sizes, because it is not appropriate view for images. So the best place for image sizes is window status bar - to be available in icon or in thumbnail views.
    If it is not possible to modify status bar from module, is it sensible to make a feature request for this?

     
    • status: closed-rejected --> open-rejected
     
  • That is OK to reopen reports.
    No, there is no statusbar plugins API currently. I'll try to make one later.
    Thank you very much.

     
    • status: open-rejected --> open-later
     
  • The API is added to the PCManFM sources. You can try it.
    Thank you very much.

     
  • Thank you for your work.
    I managed to start working on plugin and I will share some results as soon as it get ready.
    I want to point, that you made allocation in tab-page.c function on_folder_view_sel_changed:
    str = g_string_sized_new(64);
    I think that 64 is hardly enough for status bar. Some filenames are longer that 64 bytes, taking into account UTF8 symbols in names and localized text in gettext messages. It is better to make it something like 512 bytes or maybe even 1024.

     
  • You've missed the point. GString is a dinamically allocated object and will be expanded as much as needed and those 64 bytes is initial, i.e. _minimal_ size of the string. And also think about status bar which is a limited resourse so it will hardly exceed one or two hundreds of bytes in any case. :)

    Thank you very much.

     
  • Plugin

     
    Attachments
  • I have finished working plugin prototype.
    It is based on imagemagick Ping function to determine image sizes.
    One thing, I think may be done better is to make single initialization and destruction of imagemagick structures istead of doing it every time we need to get image size. It will be more efficient, if we have some one-time initialization function in this place.
    I also have very straight makefile, without any auto configuration and analyze. I'm not sure it is needed for a 40 lined program. However, it can succesfully be build outside of pcmanfm.

     
  • Screenshot of a plugin working

     
    Attachments
  • Thank you very much.
    I've added init() and finalize() callbacks for that module type.

     
  • With the last update pcmanfm now fails on exit with segfault if plugin is installed

    (gdb) run
    Starting program: /usr/bin/pcmanfm
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
    [New Thread 0xb69d8b40 (LWP 3508)]
    [New Thread 0xb5fffb40 (LWP 3509)]
    [New Thread 0xb57feb40 (LWP 3510)]
    [New Thread 0xb05fcb40 (LWP 3512)]
    [New Thread 0xafdfbb40 (LWP 3513)]
    [Thread 0xb05fcb40 (LWP 3512) exited]
    [New Thread 0xb05fcb40 (LWP 3517)]
    [Thread 0xb05fcb40 (LWP 3517) exited]
    [New Thread 0xb05fcb40 (LWP 3518)]
    [Thread 0xb05fcb40 (LWP 3518) exited]
    [New Thread 0xb05fcb40 (LWP 3519)]
    [Thread 0xb05fcb40 (LWP 3519) exited]
    [New Thread 0xb05fcb40 (LWP 3520)]
    [Thread 0xb05fcb40 (LWP 3520) exited]
    [New Thread 0xaf29ab40 (LWP 3521)]
    [Thread 0xaf29ab40 (LWP 3521) exited]
    [New Thread 0xb05fcb40 (LWP 3522)]
    [Thread 0xb05fcb40 (LWP 3522) exited]
    [New Thread 0xb05fcb40 (LWP 3523)]
    [Thread 0xb05fcb40 (LWP 3523) exited]
    [Thread 0xb5fffb40 (LWP 3509) exited]

    Program received signal SIGSEGV, Segmentation fault.
    0x08054faa in main (argc=1, argv=0xbffff224) at pcmanfm.c:289
    289 if (((FmTabPageStatusInit*)l->data)->finalize)
    (gdb) where
    #0 0x08054faa in main (argc=1, argv=0xbffff224) at pcmanfm.c:289
    (gdb) list
    284 }
    285
    286 #if FM_CHECK_VERSION(1, 2, 0)
    287 fm_module_unregister_type("tab_page_status");
    288 for (l = _tab_page_modules; l; l = l->next)
    289 if (((FmTabPageStatusInit*)l->data)->finalize)
    290 ((FmTabPageStatusInit*)l->data)->finalize();
    291 g_list_free(_tab_page_modules);
    292 _tab_page_modules = NULL;
    293 #endif
    (gdb) print l
    $1 = (GList *) 0x8115b60
    (gdb) print l->data
    $2 = (gpointer) 0xb6161054
    (gdb) print l->data->finalize
    Attempt to dereference a generic pointer.
    (gdb)

     
  • Thank you very much.
    I was wrong in finalize sequence. Fix committed.

     
  • Ok. Thank you.
    I have committed update to github repo.
    I think we can assume this request as closed for 1.2.0 release.

     
  • I've added installing pcmanfm-modules.h into /usr/include (or whatever you chose on configure) so now you should not include it into your sources anymore.
    Thank you very much. I'll create a modules page on the wiki.lxde.org and mention your module there for those who would like to have it.

     
  • I would suggest you never use strcpy or sprintf but use safe versions such as snprintf instead.
    Thank you. :)

     
  • Ok, I'll fix it :) Thanks.

     
1 2 > >> (Page 1 of 2)