Editing Documentation/Maemo 5 Developer Guide/Porting Software/Porting MaemoPad

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
This is a practical example of porting a [[Open development/Maemo roadmap/Diablo|Diablo]] (Maemo 4.1) application to [[Open development/Maemo roadmap/Fremantle|Fremantle]] (Maemo 5). The example application, MaemoPad, is a simple Notepad-like editor.
This is a practical example of porting a [[Open development/Maemo roadmap/Diablo|Diablo]] (Maemo 4.1) application to [[Open development/Maemo roadmap/Fremantle|Fremantle]] (Maemo 5). The example application, MaemoPad, is a simple Notepad-like editor.
-
[[Image:maemopad.png|frame|center|alt=Screenshot of MaemoPad|MaemoPad main window]]
+
<div align="CENTER">
-
 
+
{| summary="MaemoPad"
 +
|+ align="BOTTOM" |'''Figure:''' MaemoPad
 +
|-
 +
|
 +
[[Image:maemopad.png|MaemoPad]]
 +
|}
 +
</div>
== Porting MaemoPad from Diablo to Fremantle  ==
== Porting MaemoPad from Diablo to Fremantle  ==
Line 10: Line 16:
=== Installing MaemoPad ===
=== Installing MaemoPad ===
-
MaemoPad can be installed and tested in the Scratchbox environment.
+
MaemoPad can be installed and tested in the scratchbox environment.
* If not already activated, activate the X86 target, go to the testing directory, and download the source package of maemopad application.
* If not already activated, activate the X86 target, go to the testing directory, and download the source package of maemopad application.
Line 142: Line 148:
Hildon help library, libhildonhelp, was dropped from Fremantle so all dependencies to it had to be removed.
Hildon help library, libhildonhelp, was dropped from Fremantle so all dependencies to it had to be removed.
-
libhildonhelp-dev needs to removed from build dependencies:
+
libhildonhelp-dev needs to removed from build depencies:
Diablo: debian/control:
Diablo: debian/control:
-
<pre>
+
Build-Depends: debhelper (&gt;= 4.0.0), intltool,
-
Build-Depends: debhelper (&gt;= 4.0.0), intltool,
+
  libhildon1-dev, libgtk2.0-dev, libosso-gnomevfs2-dev,
-
libhildon1-dev, libgtk2.0-dev, libosso-gnomevfs2-dev,
+
  libglib2.0-dev, libdbus-glib-1-dev, libosso-dev, libmodest-dbus-client-dev,
-
libglib2.0-dev, libdbus-glib-1-dev, libosso-dev, libmodest-dbus-client-dev,
+
  conbtdialogs-dev,libhildonhelp-dev, libhildonfm2-dev, osso-af-settings
-
conbtdialogs-dev,libhildonhelp-dev, libhildonfm2-dev, osso-af-settings
+
-
</pre>
+
Fremantle: debian/control:
Fremantle: debian/control:
-
<pre>
+
Build-Depends: debhelper (&gt;= 4.0.0), intltool,
-
Build-Depends: debhelper (&gt;= 4.0.0), intltool,
+
  libhildon1-dev, libgtk2.0-dev, libosso-gnomevfs2-dev,
-
libhildon1-dev, libgtk2.0-dev, libosso-gnomevfs2-dev,
+
  libglib2.0-dev, libdbus-glib-1-dev, libosso-dev, libmodest-dbus-client-dev,
-
libglib2.0-dev, libdbus-glib-1-dev, libosso-dev, libmodest-dbus-client-dev,
+
  conbtdialogs-dev,  libhildonfm2-dev, osso-af-settings
-
conbtdialogs-dev,  libhildonfm2-dev, osso-af-settings
+
-
</pre>
+
Callback and all other help stuff removed:
Callback and all other help stuff removed:
Line 166: Line 168:
Diablo callbacks.c  
Diablo callbacks.c  
-
<source lang="c">
+
/* help */
-
/* help */
+
void callback_help( GtkAction * action, gpointer data )
-
void callback_help( GtkAction * action, gpointer data )
+
{
-
{
+
    osso_return_t retval;
-
    osso_return_t retval;
+
    /* connect pointer to our AppUIData struct */
-
    /* connect pointer to our AppUIData struct */
+
    AppUIData *mainview = NULL;
-
    AppUIData *mainview = NULL;
+
    mainview = ( AppUIData * ) data;
-
    mainview = ( AppUIData * ) data;
+
    g_assert(mainview != NULL && mainview->data != NULL );
-
    g_assert(mainview != NULL && mainview->data != NULL );
+
    retval = hildon_help_show(
-
    retval = hildon_help_show(
+
      mainview->data->osso, /* osso_context */
-
      mainview->data->osso, /* osso_context */
+
      HELP_TOPIC_ID,        /* topic id */
-
      HELP_TOPIC_ID,        /* topic id */
+
      HILDON_HELP_SHOW_DIALOG);
-
      HILDON_HELP_SHOW_DIALOG);
+
}
-
}
+
-
</source>
+
Diablo interface.c  
Diablo interface.c  
-
<source lang="c">
+
GtkWidget *help = NULL;
-
GtkWidget *help = NULL;
+
help = gtk_menu_item_new_with_label( _("Help") );
-
help = gtk_menu_item_new_with_label( _("Help") );
+
gtk_menu_append( main_menu, help );
-
gtk_menu_append( main_menu, help );
+
g_signal_connect( G_OBJECT( help ), "activate",  
-
g_signal_connect( G_OBJECT( help ), "activate",  
+
G_CALLBACK ( callback_help ), main );
-
  G_CALLBACK ( callback_help ), main );
+
-
</source>
+
Diablo callbacks.c  
Diablo callbacks.c  
-
<source lang="c">
+
#include <hildon/hildon-help.h>
-
#include <hildon/hildon-help.h>
+
#define HELP_TOPIC_ID "Example_MaemoPad_Content"
-
#define HELP_TOPIC_ID "Example_MaemoPad_Content"
+
-
</source>
+
Diablo configure.ac:
Diablo configure.ac:
-
<source lang="autoconf">
+
PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 hildon-help conbtdialogs)
-
PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 hildon-help conbtdialogs)
+
-
</source>
+
Fremantle configure.ac:
Fremantle configure.ac:
-
 
+
-
<source lang="c">
+
PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 conbtdialogs)
-
PKG_CHECK_MODULES(HILDON, hildon-1 hildon-fm-2 conbtdialogs)
+
-
</source>
+
Removed data/help directory which contained an example help file.
Removed data/help directory which contained an example help file.
Line 216: Line 208:
Diablo data/Makefile.am:
Diablo data/Makefile.am:
-
 
+
-
<source lang="make">
+
helpfile_engb_DATA = help/en_GB/MaemoPad.xml
-
helpfile_engb_DATA = help/en_GB/MaemoPad.xml
+
-EXTRA_DIST = $(serviceentry_DATA) $(desktopentry_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA)
-
-EXTRA_DIST = $(serviceentry_DATA) $(desktopentry_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA)
+
$(icon_scalable_DATA) *$(helpfile_engb_DATA)*
-
$(icon_scalable_DATA) *$(helpfile_engb_DATA)*
+
-
</source>
+
Diablo data/Makefile.am:
Diablo data/Makefile.am:
-
<source lang="make">
+
# Help file install directory
-
# Help file install directory
+
helpfile_engbdir=$datadir/hildon-help/en_GB
-
helpfile_engbdir=$datadir/hildon-help/en_GB
+
AC_SUBST(helpfile_engbdir)
-
AC_SUBST(helpfile_engbdir)
+
 
-
</source>
+
=== GUI design changes ===
=== GUI design changes ===
Line 237: Line 226:
Diablo interface.h  
Diablo interface.h  
-
<source lang="c">
+
/* Toolbar */
-
/* Toolbar */
+
GtkWidget* toolbar;
-
GtkWidget* toolbar;
+
GtkWidget* iconw;
-
GtkWidget* iconw;
+
GtkToolItem* new_tb;
-
GtkToolItem* new_tb;
+
GtkToolItem* open_tb;
-
GtkToolItem* open_tb;
+
...
-
...
+
GtkToolItem* fullscreen_tb;
-
GtkToolItem* fullscreen_tb;
+
 
-
</source>
+
Also the menu system was changed. In Diablo, a GtkMenu was used, but it was replaced with a HildonAppMenu in Fremantle, as shown in Figure:
 +
 
 +
<div align="CENTER">
-
Also the menu system was changed. In Diablo, a <code>GtkMenu</code> was used, but it was replaced with a <code>HildonAppMenu</code> in Fremantle, as shown in Figure:
+
{| summary="MaemoPad Menu"
 +
|+ align="BOTTOM" |'''Figure:''' MaemoPad Menu
 +
|-
 +
|
 +
<div align="CENTER">[[Image:maemopad_menu.png|MaemoPad menu]]</div>
 +
|}
-
[[Image:maemopad_menu.png|frame|center|alt=Screenshot of MaemoPad menu|MaemoPad menu]]
+
</div>
Function <code>create_menu()</code> is responsible for creating the menus in both versions:
Function <code>create_menu()</code> is responsible for creating the menus in both versions:
Line 255: Line 251:
Diablo interface.c  
Diablo interface.c  
-
<source lang="c">
+
static void create_menu( AppUIData *main )
-
static void create_menu( AppUIData *main )
+
{
-
{
+
    /* Create needed handles */
-
    /* Create needed handles */
+
    GtkMenu *main_menu;
-
    GtkMenu *main_menu;
+
    GtkWidget *file_menu, *edit_menu, *sendvia_menu;
-
    GtkWidget *file_menu, *edit_menu, *sendvia_menu;
+
    GtkWidget *separator = NULL;
-
    GtkWidget *separator = NULL;
+
    GtkWidget *close = NULL;
-
    GtkWidget *close = NULL;
+
    /* Create main menu and new menus for submenus in our drop down menu */
-
    /* Create main menu and new menus for submenus in our drop down menu */
+
    main_menu = GTK_MENU( gtk_menu_new () );
-
    main_menu = GTK_MENU( gtk_menu_new () );
+
    file_menu = gtk_menu_new ();
-
    file_menu = gtk_menu_new ();
+
    edit_menu = gtk_menu_new ();
-
    edit_menu = gtk_menu_new ();
+
    sendvia_menu = gtk_menu_new ();
-
    sendvia_menu = gtk_menu_new ();
+
    /* Create the menu items */
-
    /* Create the menu items */
+
    main->file_item = gtk_menu_item_new_with_label ( _("File") );
-
    main->file_item = gtk_menu_item_new_with_label ( _("File") );
+
    main->new_item = gtk_menu_item_new_with_label ( _("New") );
-
    main->new_item = gtk_menu_item_new_with_label ( _("New") );
+
    main->open_item = gtk_menu_item_new_with_label ( _("Open") );
-
    main->open_item = gtk_menu_item_new_with_label ( _("Open") );
+
    ...
-
    ...
+
    /* Add menu items to right menus */
-
    /* Add menu items to right menus */
+
    gtk_menu_append( main_menu, main->file_item );
-
    gtk_menu_append( main_menu, main->file_item );
+
    gtk_menu_append( file_menu, main->new_item );
-
    gtk_menu_append( file_menu, main->new_item );
+
    gtk_menu_append( file_menu, main->open_item );
-
    gtk_menu_append( file_menu, main->open_item );
+
    ...
-
    ...
+
    gtk_menu_append( main_menu, close );
-
    gtk_menu_append( main_menu, close );
+
    /* Add submenus to the right items */
-
    /* Add submenus to the right items */
+
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->file_item), file_menu );
-
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->file_item), file_menu );
+
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->edit_item), edit_menu );
-
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->edit_item), edit_menu );
+
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->sendvia_item),  sendvia_menu );
-
    gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->sendvia_item),  sendvia_menu );
+
    /* Attach the callback functions to the activate signal */
-
    /* Attach the callback functions to the activate signal */
+
    g_signal_connect( G_OBJECT( main->new_item ), "activate",  
-
    g_signal_connect( G_OBJECT( main->new_item ), "activate",  
+
      G_CALLBACK ( callback_file_new), main );
-
      G_CALLBACK ( callback_file_new), main );
+
    g_signal_connect( G_OBJECT( main->open_item ), "activate",  
-
    g_signal_connect( G_OBJECT( main->open_item ), "activate",  
+
      G_CALLBACK ( callback_file_open), main );
-
      G_CALLBACK ( callback_file_open), main );
+
    ...
-
    ...
+
    g_signal_connect( G_OBJECT( close ), "activate", gtk_main_quit, NULL );
-
    g_signal_connect( G_OBJECT( close ), "activate", gtk_main_quit, NULL );
+
    /* Add menu to HildonWindow */
-
    /* Add menu to HildonWindow */
+
    hildon_window_set_menu(main->data->window, main_menu);
-
    hildon_window_set_menu(main->data->window, main_menu);
+
    /* We need to show menu items */
-
    /* We need to show menu items */
+
    gtk_widget_show_all( GTK_WIDGET( main_menu ) );
-
    gtk_widget_show_all( GTK_WIDGET( main_menu ) );
+
}
-
}
+
-
</source>
+
Fremantle maemopad-window.c  
Fremantle maemopad-window.c  
-
<source lang="c">
+
  static GtkWidget* add_menu_item (GtkWidget *main_menu, const gchar* title,
-
static GtkWidget* add_menu_item (GtkWidget *main_menu, const gchar* title,
+
    GCallback clicked_callback, gpointer user_data)
-
    GCallback clicked_callback, gpointer user_data)
+
{
-
{
+
  HildonAppMenu *app_menu = HILDON_APP_MENU (main_menu);
-
  HildonAppMenu *app_menu = HILDON_APP_MENU (main_menu);
+
  /* Create a button, add it, and return it: */  
-
  /* Create a button, add it, and return it: */  
+
  GtkWidget *button = hildon_button_new_with_text (HILDON_SIZE_AUTO,  
-
  GtkWidget *button = hildon_button_new_with_text (HILDON_SIZE_AUTO,  
+
        HILDON_BUTTON_ARRANGEMENT_VERTICAL, title, NULL);
-
        HILDON_BUTTON_ARRANGEMENT_VERTICAL, title, NULL);
+
  gtk_widget_show (button);
-
  gtk_widget_show (button);
+
  g_signal_connect_after (button, "clicked",  
-
  g_signal_connect_after (button, "clicked",  
+
  G_CALLBACK (clicked_callback), user_data);
-
  G_CALLBACK (clicked_callback), user_data);
+
  hildon_app_menu_append (app_menu, GTK_BUTTON (button));
-
  hildon_app_menu_append (app_menu, GTK_BUTTON (button));
+
  return button;
-
  return button;
+
}
-
}
+
/* Create the menu items needed: */
-
/* Create the menu items needed: */
+
static void create_menu (MaemopadWindow *self)
-
static void create_menu (MaemopadWindow *self)
+
{
-
{
+
  /* Create needed handles */
-
  /* Create needed handles */
+
  GtkWidget *main_menu = hildon_app_menu_new ();
-
  GtkWidget *main_menu = hildon_app_menu_new ();
+
  /* Create the menu items */
-
  /* Create the menu items */
+
  self->new_item = add_menu_item (main_menu, _("New"),
-
  self->new_item = add_menu_item (main_menu, _("New"),
+
    G_CALLBACK (&maemopad_window_on_menu_file_new), self);
-
    G_CALLBACK (&maemopad_window_on_menu_file_new), self);
+
  self->open_item = add_menu_item (main_menu, _("Open"),
-
  self->open_item = add_menu_item (main_menu, _("Open"),
+
    G_CALLBACK (&maemopad_window_on_menu_file_open), self);
-
    G_CALLBACK (&maemopad_window_on_menu_file_open), self);
+
  ...
-
  ...
+
    self->close_item = add_menu_item (main_menu, _("Close"),
-
  self->close_item = add_menu_item (main_menu, _("Close"),
+
    G_CALLBACK (&maemopad_window_on_menu_close), self);
-
    G_CALLBACK (&maemopad_window_on_menu_close), self);
+
  /* Add menu to HildonWindow */
-
  /* Add menu to HildonWindow */
+
  hildon_window_set_app_menu (
-
  hildon_window_set_app_menu (
+
    HILDON_WINDOW (self),
-
    HILDON_WINDOW (self),
+
    HILDON_APP_MENU (main_menu));
-
    HILDON_APP_MENU (main_menu));
+
  /* We need to show menu items */
-
  /* We need to show menu items */
+
  gtk_widget_show_all (GTK_WIDGET (main_menu));
-
  gtk_widget_show_all (GTK_WIDGET (main_menu));
+
}
-
}
+
 
-
</source>
+
 
As a result to changes in the .c file, the following menu widget declarations used in Diablo became unnecessary:
As a result to changes in the .c file, the following menu widget declarations used in Diablo became unnecessary:
Line 339: Line 333:
Diablo interface.h  
Diablo interface.h  
-
<source lang="c">
+
GtkWidget *file_item;
-
GtkWidget *file_item;
+
GtkWidget *edit_item;
-
GtkWidget *edit_item;
+
GtkWidget *sendvia_item;
-
GtkWidget *sendvia_item;
+
-
</source>
+
-
Menu callbacks were also changed. There were some changes in the callbacks themselves as a result of code reorganizations, but the main change from the menu viewpoint was that the 1st arguments of the callbacks were changed from <code>GtkAction</code> to <code>GtkButton</code>, like in the following example:
+
 
 +
 
 +
Menu callbacks were also changed. There were some changes in the callbacks themselves as a result of code reorganizations, but the main change from the menu viewpoint was that the 1st arguments of the callbacks were changed from GtkAction to GtkButton, like in the following example:
Diablo callbacks.c  
Diablo callbacks.c  
-
<source lang="c">
+
void callback_file_new(GtkAction * action, gpointer data)
-
void callback_file_new(GtkAction * action, gpointer data)
+
-
</source>
+
Fremantle maemopad-window.c  
Fremantle maemopad-window.c  
-
<source lang="c">
+
static void maemopad_window_on_menu_file_new (GtkButton *button, gpointer data)
-
static void maemopad_window_on_menu_file_new (GtkButton *button, gpointer data)
+
 
-
</source>
+
=== Other updates in GTK+ and Hildon ===
=== Other updates in GTK+ and Hildon ===
 +
<ul>
<ul>
<li>
<li>
Rich text support was changed with the new GTK+, as described in [http://live.gnome.org/Maemo/Gtk210Migration Maemo-GTK+ 2.6 to 2.10 Migration].This required editing two lines:
Rich text support was changed with the new GTK+, as described in [http://live.gnome.org/Maemo/Gtk210Migration Maemo-GTK+ 2.6 to 2.10 Migration].This required editing two lines:
 +
<br /><br />
 +
Part of function create_textarea() in Diablo interface.c
-
Part of function <code>create_textarea()</code> in Diablo interface.c
+
<pre>
-
 
+
-
<source lang="c">
+
/* Enable Rich Text Support */
/* Enable Rich Text Support */
gtk_text_buffer_set_can_paste_rich_text ( main->buffer, TRUE );
gtk_text_buffer_set_can_paste_rich_text ( main->buffer, TRUE );
gtk_text_buffer_set_rich_text_format ( main->buffer, "RTF" );
gtk_text_buffer_set_rich_text_format ( main->buffer, "RTF" );
-
</source>
+
</pre>
-
Part of function <code>create_textarea()</code> in Fremantle maemopad-window.c  
+
Part of function create_textarea() in Fremantle maemopad-window.c  
-
<source lang="c">
+
<pre>
/* Enable Rich Text Support */
/* Enable Rich Text Support */
gtk_text_buffer_register_serialize_tagset (self->buffer, "RTF");
gtk_text_buffer_register_serialize_tagset (self->buffer, "RTF");
gtk_text_buffer_register_deserialize_tagset (self->buffer, "RTF");
gtk_text_buffer_register_deserialize_tagset (self->buffer, "RTF");
-
</source>
+
</pre>
</li>
</li>
-
<li>
 
-
<code>HildonFontSelectionDialog</code> was deprecated and replaced with a <code>GtkFontButton</code>. In Diablo, the font callback was a callback to a regular <code>GtkAction</code>:
 
 +
<li>
 +
HildonFontSelectionDialog was deprecated and replaced with a GtkFontButton.
 +
In Diablo, the font callback was a callback to a regular GtkAction:
 +
<br /><br />
callback.c  
callback.c  
-
<source lang="c">
+
<pre>
void callback_font( GtkAction * action, gpointer data )
void callback_font( GtkAction * action, gpointer data )
{
{
Line 398: Line 392:
     }
     }
}
}
-
</source>
+
</pre>
-
 
+
-
Function <code>callback_font</code> got the font from an auxiliary function <code>interface_font_chooser()</code> and then modified the font in the text view. The auxiliary function <code>interface_font_chooser()</code> in turn opened a <code>HildonFontSelectionDialog</code> that returned the font parameters:
+
 +
Function <code>callback_font</code> got the font from an auxiliary function <code>interface_font_chooser()</code> and then modified the font in the text view. The auxiliary function <code>interface_font_chooser()</code> in turn opened a HildonFontSelectionDialog that returned the font parameters:
 +
<br /><br />
callback.c  
callback.c  
-
<source lang="c">
+
<pre>
/* Font chooser */
/* Font chooser */
PangoFontDescription* interface_font_chooser( AppUIData * main )
PangoFontDescription* interface_font_chooser( AppUIData * main )
Line 437: Line 431:
     return font;
     return font;
}
}
-
</source>
+
</pre>
-
Instead of the deprecated <code>HildonFontSelectionDialog</code>, Fremantle uses a <code>GtkFontButton</code> directly in the font button callback:
 
 +
Instead of the deprecated HildonFontSelectionDialog, Fremantle uses a GtkFontButton directly in the font button callback:
 +
<br /><br />
maemopad-window.c  
maemopad-window.c  
-
<source lang="c">
+
<pre>
/* font */
/* font */
static void maemopad_window_on_font_set (GtkFontButton *button, gpointer data)
static void maemopad_window_on_font_set (GtkFontButton *button, gpointer data)
Line 460: Line 455:
   }
   }
}
}
-
</source>
+
</pre>
-
This <code>GtkFontButton</code> was initialized in function <code>create_menu()</code> (see above) in <code>maemopad-window.c</code> so that it would respond to the <code>"font-set"</code> signal and call the callback above:
+
This GtkFontButton was initialized in function <code>create_menu()</code> (see above) in maemopad-window.c so that it would respond to the <code>"font-set"</code> signal and call the callback above:
-
<source lang="c">
+
  self->font_item = gtk_font_button_new ();
-
self->font_item = gtk_font_button_new ();
+
  gtk_widget_show (self->font_item);
-
gtk_widget_show (self->font_item);
+
  g_signal_connect_after (self->font_item, "font-set",  
-
g_signal_connect_after (self->font_item, "font-set",  
+
    G_CALLBACK (maemopad_window_on_font_set), self);
-
  G_CALLBACK (maemopad_window_on_font_set), self);
+
  hildon_app_menu_append (HILDON_APP_MENU (main_menu), GTK_BUTTON (self->font_item));
-
hildon_app_menu_append (HILDON_APP_MENU (main_menu), GTK_BUTTON (self->font_item));
+
-
</source>
+
</li>
</li>
-
<li>
 
-
Instead of <code>GtkTextView</code>, a [http://maemo.org/api_refs/5.0/5.0-final/hildon/HildonTextView.html HildonTextView] is now used:
 
 +
<li>
 +
Instead of GtkTextView, a [http://maemo.org/api_refs/5.0/5.0-final/hildon/HildonTextView.html HildonTextView] is now used:
 +
<br /><br />
Diablo callback.c
Diablo callback.c
-
<source lang="c">
+
<pre>
/* Create the text area */
/* Create the text area */
void create_textarea( AppUIData *main )
void create_textarea( AppUIData *main )
Line 489: Line 483:
     ...
     ...
}
}
-
</source>
+
</pre>
Fremantle maemopad-window.c
Fremantle maemopad-window.c
-
<source lang="c">
+
<pre>
static void create_textarea (MaemopadWindow *self)
static void create_textarea (MaemopadWindow *self)
{
{
Line 502: Line 496:
     self->buffer = hildon_text_view_get_buffer (GTK_TEXT_VIEW (self->textview));
     self->buffer = hildon_text_view_get_buffer (GTK_TEXT_VIEW (self->textview));
}
}
-
</source>
+
</pre>
</li>
</li>
 +
<li>
<li>
All Hildon applications should now initialize hildon before using it. In maemopad this is done by calling <code>hildon_gtk_init()</code> which also calls <code>gtk_init()</code> so the original call can be removed:
All Hildon applications should now initialize hildon before using it. In maemopad this is done by calling <code>hildon_gtk_init()</code> which also calls <code>gtk_init()</code> so the original call can be removed:
-
 
+
<br /><br />
Diablo main.c  
Diablo main.c  
-
<source lang="c">
+
<pre>
/* Init the gtk - must be called before any hildon stuff */
/* Init the gtk - must be called before any hildon stuff */
gtk_init( &argc, &argv );
gtk_init( &argc, &argv );
-
</source>
+
</pre>
Fremantle main.c
Fremantle main.c
-
<source lang="c">
+
<pre>
/* Inititialize GTK+ and hildon: */
/* Inititialize GTK+ and hildon: */
hildon_gtk_init( &argc, &argv );
hildon_gtk_init( &argc, &argv );
-
</source>
+
</pre>
[[Category:Development]]
[[Category:Development]]
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Fremantle]]
[[Category:Fremantle]]

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)