#include <string.h>
#include <liberdm/display.h>
#include <libermanifest/ermanifest.h>
#include "contentListerLog.h"
#include "gtkContentListItem.h"
#include "icons.h"
#include "lister.h"
Go to the source code of this file.
<File description>="">
Definition in file gtkContentListItem.c.
#define MAX_CHARACTERS 52 |
Definition at line 43 of file gtkContentListItem.c.
int get_string_lines | ( | const gchar * | string | ) | [static] |
Definition at line 312 of file gtkContentListItem.c.
00313 { 00314 int count = 0; 00315 if (NULL == string) 00316 { 00317 return count; 00318 } 00319 00320 while(string && *string != 0) 00321 { 00322 string = strchr(string, '\n'); 00323 if (string) 00324 { 00325 ++count; ++string; continue; 00326 } 00327 return count; 00328 } 00329 return count; 00330 }
static void gtk_content_list_item_class_init | ( | GtkContentListItemClass * | klass | ) | [static] |
GType gtk_content_list_item_get_type | ( | void | ) |
returns type of GtkListItem widget
Definition at line 64 of file gtkContentListItem.c.
00065 { 00066 static GType content_list_item_type = 0; 00067 00068 if (!content_list_item_type) 00069 { 00070 static const GTypeInfo content_list_item_info = { 00071 sizeof(GtkContentListItemClass), 00072 NULL, /* base_init */ 00073 NULL, /* base_finalize */ 00074 (GClassInitFunc) gtk_content_list_item_class_init, 00075 NULL, /* class_finalize */ 00076 NULL, /* class_data */ 00077 sizeof(GtkContentListItem), 00078 0, /* n_preallocs */ 00079 (GInstanceInitFunc) gtk_content_list_item_init, 00080 }; 00081 00082 content_list_item_type = g_type_register_static(GTK_TYPE_HBOX, "ListItem", &content_list_item_info, 0); 00083 } 00084 return content_list_item_type; 00085 }
void gtk_content_list_item_hide_thumb | ( | GtkContentListItem * | item | ) |
Hide thumb
item | the GtkListItem widget |
Definition at line 290 of file gtkContentListItem.c.
00291 { 00292 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00293 gtk_widget_hide(GTK_WIDGET(item->image)); 00294 }
static void gtk_content_list_item_init | ( | GtkContentListItem * | list_item | ) | [static] |
Definition at line 110 of file gtkContentListItem.c.
00111 { 00112 GtkWidget *alignment; 00113 00114 // not homogenous => no expand of the widgets added to the box - CONTENT_HBOX_SPACE pixels spacing 00115 gtk_box_set_homogeneous(GTK_BOX(list_item), FALSE); 00116 gtk_box_set_spacing(GTK_BOX(list_item), HBOX_TEXT_THUMB_SPACING); 00117 00118 list_item->cursorspace = gtk_event_box_new(); 00119 gtk_widget_set_name(GTK_WIDGET(list_item->cursorspace), "listCursorItem_background"); 00120 gtk_widget_set_size_request(GTK_WIDGET(list_item->cursorspace), CURSOR_BOX_MIN_WIDTH, LISTER_ITEM_HEIGHT); 00121 gtk_box_pack_start(GTK_BOX(list_item), list_item->cursorspace, FALSE, FALSE, 0); 00122 list_item->cursorbox = gtk_event_box_new(); 00123 gtk_widget_set_name(GTK_WIDGET(list_item->cursorbox), "listCursorItem"); 00124 gtk_container_add(GTK_CONTAINER(list_item->cursorspace), list_item->cursorbox); 00125 00126 list_item->thumbbox = gtk_event_box_new(); 00127 gtk_widget_set_name(GTK_WIDGET(list_item->thumbbox), "listThumbItem_background"); 00128 gtk_widget_set_size_request(GTK_WIDGET(list_item->thumbbox), THUMB_BOX_MIN_WIDTH, LISTER_ITEM_HEIGHT); 00129 gtk_box_pack_start(GTK_BOX(list_item), list_item->thumbbox, FALSE, FALSE, 0); 00130 00131 list_item->textbox = gtk_event_box_new(); 00132 gtk_widget_set_name(GTK_WIDGET(list_item->textbox), "listTextItem_background"); 00133 gtk_widget_set_size_request(GTK_WIDGET(list_item->textbox), TEXT_BOX_MIN_WIDTH, LISTER_ITEM_HEIGHT); 00134 gtk_box_pack_start(GTK_BOX(list_item), list_item->textbox, FALSE, FALSE, 0); 00135 00136 list_item->image = gtk_image_new(); 00137 gtk_container_add(GTK_CONTAINER(list_item->thumbbox), list_item->image); 00138 list_item->pixmap = NULL; 00139 00140 // content string data 00141 alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); 00142 gtk_widget_set_size_request(GTK_WIDGET(alignment), TEXT_BOX_MIN_WIDTH, LISTER_ITEM_HEIGHT); 00143 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), VBOX_TEXT_BORDER, VBOX_TEXT_BORDER, HBOX_TEXT_BORDER, HBOX_TEXT_BORDER); 00144 gtk_container_add(GTK_CONTAINER(list_item->textbox), alignment); 00145 00146 // file bar layout 00147 // table 6x6 00148 list_item->table = gtk_table_new (6, 6, TRUE); 00149 // list_item->vbox = gtk_vbox_new(FALSE, VBOX_TEXT_TEXT_SPACING); 00150 // gtk_widget_set_size_request(GTK_WIDGET(list_item->vbox), TEXT_BOX_MIN_WIDTH, (-1)); 00151 // gtk_container_add(GTK_CONTAINER(alignment), list_item->vbox); 00152 gtk_widget_set_size_request(GTK_WIDGET(list_item->table), TEXT_BOX_MIN_WIDTH, (-1)); 00153 gtk_table_set_col_spacings((GtkTable *)list_item->table, 10); 00154 gtk_container_add(GTK_CONTAINER(alignment), list_item->table); 00155 00156 00157 list_item->title = gtk_label_new(""); 00158 gtk_misc_set_alignment(GTK_MISC(list_item->title), 0.0, 0.0); 00159 //gtk_label_set_ellipsize(GTK_LABEL(list_item->title), PANGO_ELLIPSIZE_END); 00160 //gtk_label_set_justify(GTK_LABEL(list_item->title), GTK_JUSTIFY_LEFT); 00161 gtk_widget_set_name(GTK_WIDGET(list_item->title), "list_item_title"); 00162 // gtk_box_pack_start(GTK_BOX(list_item->vbox), list_item->title, FALSE, FALSE, 0); 00163 gtk_table_attach_defaults(GTK_TABLE(list_item->table), list_item->title, 0, 6, 0, 2); 00164 00165 list_item->subtitle = gtk_label_new(""); 00166 gtk_misc_set_alignment(GTK_MISC(list_item->subtitle), 0.0, 0.0); 00167 //gtk_label_set_ellipsize(GTK_LABEL(list_item->title), PANGO_ELLIPSIZE_END); 00168 //gtk_label_set_justify(GTK_LABEL(list_item->subtitle), GTK_JUSTIFY_LEFT); 00169 gtk_widget_set_name(GTK_WIDGET(list_item->subtitle), "list_item_subtitle"); 00170 // gtk_box_pack_start(GTK_BOX(list_item->vbox), list_item->subtitle, FALSE, FALSE, 0); 00171 gtk_table_attach_defaults(GTK_TABLE(list_item->table), list_item->subtitle, 0, 6, 2, 3 ); 00172 00173 list_item->description = gtk_label_new(""); 00174 gtk_widget_set_name(GTK_WIDGET(list_item->description), "list_item_description"); 00175 gtk_misc_set_alignment(GTK_MISC(list_item->description), 0.0, 0.0); 00176 //gtk_label_set_ellipsize(GTK_LABEL(list_item->description), PANGO_ELLIPSIZE_END); 00177 gtk_widget_set_size_request(GTK_WIDGET(list_item->description), TEXT_BOX_MIN_WIDTH * 4 / 5, -1 ); 00178 gtk_label_set_single_line_mode(GTK_LABEL(list_item->description), FALSE); 00179 gtk_label_set_line_wrap(GTK_LABEL(list_item->description), TRUE); 00180 gtk_table_attach_defaults(GTK_TABLE(list_item->table), list_item->description, 0, 5, 3, 6); 00181 00182 list_item->information = gtk_label_new(""); 00183 gtk_misc_set_alignment(GTK_MISC(list_item->information), 0.0, 0.0); 00184 //gtk_label_set_ellipsize(GTK_LABEL(list_item->information), PANGO_ELLIPSIZE_END); 00185 //gtk_label_set_justify(GTK_LABEL(list_item->information), GTK_JUSTIFY_LEFT); 00186 gtk_widget_set_name(GTK_WIDGET(list_item->information), "list_item_information"); 00187 // gtk_box_pack_start(GTK_BOX(list_item->vbox), list_item->subtitle, FALSE, FALSE, 0); 00188 gtk_table_attach_defaults(GTK_TABLE(list_item->table), list_item->information, 5, 6, 3, 6); 00189 00190 gtk_widget_show_all(GTK_WIDGET(list_item)); 00191 }
GtkWidget* gtk_content_list_item_new | ( | index | ) |
Definition at line 51 of file gtkContentListItem.c.
00052 { 00053 GtkContentListItem *listItem; 00054 00055 listItem = (GtkContentListItem *) g_object_new(GTK_CONTENT_LIST_ITEM_TYPE, NULL); 00056 00057 CL_LOGPRINTF("listItem [%p]", listItem); 00058 listItem->index = index; 00059 00060 return GTK_WIDGET(listItem); 00061 }
void gtk_content_list_item_set_description | ( | GtkContentListItem * | item, | |
const gchar * | text | |||
) |
Set description text of GtkListItem widget
item | the GtkListItem widget | |
text |
Definition at line 213 of file gtkContentListItem.c.
00214 { 00215 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00216 g_return_if_fail(text != NULL); 00217 CL_LOGPRINTF("text %s", text); 00218 00219 // check length 00220 if (strlen(text) >= 2 * MAX_CHARACTERS || get_string_lines(text) >= 2) 00221 { 00222 // can not handle multi lines, TODO 00223 gtk_label_set_ellipsize(GTK_LABEL(item->description), PANGO_ELLIPSIZE_END); 00224 } 00225 else 00226 { 00227 gtk_label_set_ellipsize(GTK_LABEL(item->description), PANGO_ELLIPSIZE_NONE); 00228 } 00229 gtk_label_set_text(GTK_LABEL(item->description), text); 00230 }
void gtk_content_list_item_set_icon_thumb | ( | GtkContentListItem * | item, | |
unsigned int | iconID | |||
) |
Set thumb of GtkListItem widget
item | the GtkListItem widget | |
iconID | icon identification |
Definition at line 270 of file gtkContentListItem.c.
00271 { 00272 GdkPixbuf *pixbuf; 00273 00274 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00275 00276 pixbuf = icons_get(iconID); 00277 00278 if (pixbuf) 00279 { 00280 gtk_image_set_from_pixbuf(GTK_IMAGE(item->image), pixbuf); 00281 gtk_widget_show(GTK_WIDGET(item->image)); 00282 } 00283 else 00284 { 00285 gtk_widget_hide(GTK_WIDGET(item->image)); 00286 } 00287 return; 00288 }
void gtk_content_list_item_set_information | ( | GtkContentListItem * | item, | |
const gchar * | text | |||
) |
Set information text of GtkListItem widget
item | the GtkListItem widget | |
text |
Definition at line 232 of file gtkContentListItem.c.
00233 { 00234 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00235 g_return_if_fail(text != NULL); 00236 CL_LOGPRINTF("text %s", text); 00237 gtk_label_set_text(GTK_LABEL(item->information), text); 00238 }
void gtk_content_list_item_set_subtitle | ( | GtkContentListItem * | item, | |
const gchar * | text | |||
) |
Set subtitle text of GtkListItem widget
item | the GtkListItem widget | |
text |
Definition at line 203 of file gtkContentListItem.c.
00204 { 00205 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00206 g_return_if_fail(text != NULL); 00207 00208 CL_LOGPRINTF("text %s", text); 00209 00210 gtk_label_set_text(GTK_LABEL(item->subtitle), text); 00211 }
void gtk_content_list_item_set_thumb | ( | GtkContentListItem * | item, | |
const char * | iconURL | |||
) |
Set thumb of GtkListItem widget
item | the GtkListItem widget | |
iconURL | icon path |
Definition at line 240 of file gtkContentListItem.c.
00241 { 00242 GdkPixbuf *pixbuf = NULL; 00243 00244 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00245 g_return_if_fail(NULL != iconURL); 00246 00247 pixbuf = icons_load(iconURL); 00248 if (pixbuf) 00249 { 00250 // free the old one 00251 if (item->pixmap) 00252 { 00253 icons_unload(item->pixmap); 00254 item->pixmap = NULL; 00255 } 00256 // set the new one 00257 item->pixmap = pixbuf; 00258 00259 gtk_image_set_from_pixbuf(GTK_IMAGE(item->image), pixbuf); 00260 00261 gtk_widget_show(GTK_WIDGET(item->image)); 00262 } 00263 else 00264 { 00265 gtk_widget_hide(GTK_WIDGET(item->image)); 00266 } 00267 return; 00268 }
void gtk_content_list_item_set_title | ( | GtkContentListItem * | item, | |
const gchar * | text | |||
) |
Set title text of GtkListItem widget
text |
Definition at line 193 of file gtkContentListItem.c.
00194 { 00195 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00196 g_return_if_fail(text != NULL); 00197 00198 CL_LOGPRINTF("text %s", text); 00199 00200 gtk_label_set_text(GTK_LABEL(item->title), text); 00201 }
void gtk_content_list_item_show_cursor | ( | GtkContentListItem * | item, | |
gboolean | show | |||
) |
Clear thumb and free allocated resources of the GtkListItem widget
item | the GtkListItem widget | |
show |
Definition at line 296 of file gtkContentListItem.c.
00297 { 00298 g_return_if_fail(IS_GTK_CONTENT_LIST_ITEM(item)); 00299 00300 CL_CURSORPRINTF("entry %s", (show == TRUE) ? "TRUE" : "FALSE"); 00301 00302 if (show) 00303 { 00304 gtk_widget_show(item->cursorbox); 00305 } 00306 else 00307 { 00308 gtk_widget_hide(item->cursorbox); 00309 } 00310 }